@edhspace/api 0.0.0-stage → 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.
@@ -0,0 +1,474 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const apiVersion: 1;
4
+ declare const permissionSchema: z.ZodEnum<{
5
+ "network.request": "network.request";
6
+ "deck.read": "deck.read";
7
+ "selection.read": "selection.read";
8
+ "deck.propose": "deck.propose";
9
+ "cards.inspect": "cards.inspect";
10
+ "cards.search": "cards.search";
11
+ "workspace.open": "workspace.open";
12
+ "notifications.show": "notifications.show";
13
+ "storage.read": "storage.read";
14
+ "storage.write": "storage.write";
15
+ "preferences.read": "preferences.read";
16
+ "preferences.write": "preferences.write";
17
+ }>;
18
+ type ExtensionPermission = z.infer<typeof permissionSchema>;
19
+ declare const networkEndpointSchema: z.ZodObject<{
20
+ id: z.ZodString;
21
+ title: z.ZodString;
22
+ url: z.ZodString;
23
+ methods: z.ZodArray<z.ZodEnum<{
24
+ GET: "GET";
25
+ POST: "POST";
26
+ }>>;
27
+ }, z.core.$strict>;
28
+ type NetworkEndpoint = z.infer<typeof networkEndpointSchema>;
29
+ declare const networkRequestSchema: z.ZodObject<{
30
+ endpoint: z.ZodString;
31
+ path: z.ZodDefault<z.ZodString>;
32
+ method: z.ZodDefault<z.ZodEnum<{
33
+ GET: "GET";
34
+ POST: "POST";
35
+ }>>;
36
+ query: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
37
+ body: z.ZodOptional<z.ZodJSONSchema>;
38
+ }, z.core.$strict>;
39
+ type NetworkRequest = z.input<typeof networkRequestSchema>;
40
+ declare const extensionManifestSchema: z.ZodObject<{
41
+ id: z.ZodString;
42
+ apiVersion: z.ZodLiteral<1>;
43
+ version: z.ZodString;
44
+ title: z.ZodString;
45
+ description: z.ZodString;
46
+ author: z.ZodString;
47
+ permissions: z.ZodArray<z.ZodEnum<{
48
+ "network.request": "network.request";
49
+ "deck.read": "deck.read";
50
+ "selection.read": "selection.read";
51
+ "deck.propose": "deck.propose";
52
+ "cards.inspect": "cards.inspect";
53
+ "cards.search": "cards.search";
54
+ "workspace.open": "workspace.open";
55
+ "notifications.show": "notifications.show";
56
+ "storage.read": "storage.read";
57
+ "storage.write": "storage.write";
58
+ "preferences.read": "preferences.read";
59
+ "preferences.write": "preferences.write";
60
+ }>>;
61
+ panels: z.ZodArray<z.ZodObject<{
62
+ id: z.ZodString;
63
+ title: z.ZodString;
64
+ location: z.ZodOptional<z.ZodEnum<{
65
+ workspace: "workspace";
66
+ sidebar: "sidebar";
67
+ }>>;
68
+ }, z.core.$strict>>;
69
+ commands: z.ZodDefault<z.ZodArray<z.ZodObject<{
70
+ id: z.ZodString;
71
+ title: z.ZodString;
72
+ }, z.core.$strict>>>;
73
+ preferences: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
74
+ id: z.ZodString;
75
+ title: z.ZodString;
76
+ description: z.ZodOptional<z.ZodString>;
77
+ type: z.ZodLiteral<"text">;
78
+ default: z.ZodString;
79
+ }, z.core.$strict>, z.ZodObject<{
80
+ id: z.ZodString;
81
+ title: z.ZodString;
82
+ description: z.ZodOptional<z.ZodString>;
83
+ type: z.ZodLiteral<"boolean">;
84
+ default: z.ZodBoolean;
85
+ }, z.core.$strict>, z.ZodObject<{
86
+ id: z.ZodString;
87
+ title: z.ZodString;
88
+ description: z.ZodOptional<z.ZodString>;
89
+ type: z.ZodLiteral<"number">;
90
+ default: z.ZodNumber;
91
+ }, z.core.$strict>, z.ZodObject<{
92
+ id: z.ZodString;
93
+ title: z.ZodString;
94
+ description: z.ZodOptional<z.ZodString>;
95
+ type: z.ZodLiteral<"select">;
96
+ default: z.ZodString;
97
+ options: z.ZodArray<z.ZodObject<{
98
+ value: z.ZodString;
99
+ label: z.ZodString;
100
+ }, z.core.$strict>>;
101
+ }, z.core.$strict>], "type">>>;
102
+ network: z.ZodDefault<z.ZodArray<z.ZodObject<{
103
+ id: z.ZodString;
104
+ title: z.ZodString;
105
+ url: z.ZodString;
106
+ methods: z.ZodArray<z.ZodEnum<{
107
+ GET: "GET";
108
+ POST: "POST";
109
+ }>>;
110
+ }, z.core.$strict>>>;
111
+ }, z.core.$strict>;
112
+ type ExtensionManifest = z.infer<typeof extensionManifestSchema>;
113
+ declare const extensionCardSchema: z.ZodObject<{
114
+ id: z.ZodString;
115
+ name: z.ZodString;
116
+ quantity: z.ZodNumber;
117
+ manaCost: z.ZodOptional<z.ZodString>;
118
+ manaValue: z.ZodOptional<z.ZodNumber>;
119
+ typeLine: z.ZodOptional<z.ZodString>;
120
+ commander: z.ZodOptional<z.ZodBoolean>;
121
+ }, z.core.$strict>;
122
+ type ExtensionCard = z.infer<typeof extensionCardSchema>;
123
+ declare const extensionDeckSchema: z.ZodObject<{
124
+ id: z.ZodUUID;
125
+ name: z.ZodString;
126
+ format: z.ZodString;
127
+ revision: z.ZodString;
128
+ cards: z.ZodArray<z.ZodObject<{
129
+ id: z.ZodString;
130
+ name: z.ZodString;
131
+ quantity: z.ZodNumber;
132
+ manaCost: z.ZodOptional<z.ZodString>;
133
+ manaValue: z.ZodOptional<z.ZodNumber>;
134
+ typeLine: z.ZodOptional<z.ZodString>;
135
+ commander: z.ZodOptional<z.ZodBoolean>;
136
+ }, z.core.$strict>>;
137
+ }, z.core.$strict>;
138
+ type ExtensionDeck = z.infer<typeof extensionDeckSchema>;
139
+ type ExtensionTheme = {
140
+ background: string;
141
+ foreground: string;
142
+ muted: string;
143
+ accent: string;
144
+ border: string;
145
+ font: string;
146
+ };
147
+ declare const deckOperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
148
+ op: z.ZodLiteral<"add">;
149
+ cardId: z.ZodString;
150
+ quantity: z.ZodNumber;
151
+ category: z.ZodString;
152
+ }, z.core.$strict>, z.ZodObject<{
153
+ op: z.ZodLiteral<"remove">;
154
+ cardId: z.ZodString;
155
+ quantity: z.ZodNumber;
156
+ }, z.core.$strict>, z.ZodObject<{
157
+ op: z.ZodLiteral<"tag">;
158
+ cardIds: z.ZodArray<z.ZodString>;
159
+ tags: z.ZodArray<z.ZodString>;
160
+ }, z.core.$strict>], "op">;
161
+ type DeckOperation = z.infer<typeof deckOperationSchema>;
162
+ declare const proposalReceiptSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
163
+ id: z.ZodUUID;
164
+ status: z.ZodEnum<{
165
+ pending: "pending";
166
+ dismissed: "dismissed";
167
+ }>;
168
+ revision: z.ZodOptional<z.ZodString>;
169
+ undoId: z.ZodOptional<z.ZodUUID>;
170
+ }, z.core.$strict>, z.ZodObject<{
171
+ id: z.ZodUUID;
172
+ status: z.ZodLiteral<"applied">;
173
+ revision: z.ZodString;
174
+ undoId: z.ZodUUID;
175
+ }, z.core.$strict>], "status">;
176
+ type ProposalReceipt = z.infer<typeof proposalReceiptSchema>;
177
+ declare const requestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
178
+ method: z.ZodLiteral<"network.request">;
179
+ params: z.ZodObject<{
180
+ endpoint: z.ZodString;
181
+ path: z.ZodDefault<z.ZodString>;
182
+ method: z.ZodDefault<z.ZodEnum<{
183
+ GET: "GET";
184
+ POST: "POST";
185
+ }>>;
186
+ query: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
187
+ body: z.ZodOptional<z.ZodJSONSchema>;
188
+ }, z.core.$strict>;
189
+ type: z.ZodLiteral<"request">;
190
+ id: z.ZodUUID;
191
+ protocol: z.ZodLiteral<"edhspace.extension">;
192
+ apiVersion: z.ZodLiteral<1>;
193
+ sessionId: z.ZodUUID;
194
+ }, z.core.$strict>, z.ZodObject<{
195
+ method: z.ZodLiteral<"deck.read">;
196
+ params: z.ZodObject<{}, z.core.$strict>;
197
+ type: z.ZodLiteral<"request">;
198
+ id: z.ZodUUID;
199
+ protocol: z.ZodLiteral<"edhspace.extension">;
200
+ apiVersion: z.ZodLiteral<1>;
201
+ sessionId: z.ZodUUID;
202
+ }, z.core.$strict>, z.ZodObject<{
203
+ method: z.ZodLiteral<"selection.read">;
204
+ params: z.ZodObject<{}, z.core.$strict>;
205
+ type: z.ZodLiteral<"request">;
206
+ id: z.ZodUUID;
207
+ protocol: z.ZodLiteral<"edhspace.extension">;
208
+ apiVersion: z.ZodLiteral<1>;
209
+ sessionId: z.ZodUUID;
210
+ }, z.core.$strict>, z.ZodObject<{
211
+ method: z.ZodLiteral<"deck.propose">;
212
+ params: z.ZodObject<{
213
+ expectedRevision: z.ZodString;
214
+ operations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
215
+ op: z.ZodLiteral<"add">;
216
+ cardId: z.ZodString;
217
+ quantity: z.ZodNumber;
218
+ category: z.ZodString;
219
+ }, z.core.$strict>, z.ZodObject<{
220
+ op: z.ZodLiteral<"remove">;
221
+ cardId: z.ZodString;
222
+ quantity: z.ZodNumber;
223
+ }, z.core.$strict>, z.ZodObject<{
224
+ op: z.ZodLiteral<"tag">;
225
+ cardIds: z.ZodArray<z.ZodString>;
226
+ tags: z.ZodArray<z.ZodString>;
227
+ }, z.core.$strict>], "op">>;
228
+ }, z.core.$strict>;
229
+ type: z.ZodLiteral<"request">;
230
+ id: z.ZodUUID;
231
+ protocol: z.ZodLiteral<"edhspace.extension">;
232
+ apiVersion: z.ZodLiteral<1>;
233
+ sessionId: z.ZodUUID;
234
+ }, z.core.$strict>, z.ZodObject<{
235
+ method: z.ZodLiteral<"cards.inspect">;
236
+ params: z.ZodObject<{
237
+ cardId: z.ZodString;
238
+ }, z.core.$strict>;
239
+ type: z.ZodLiteral<"request">;
240
+ id: z.ZodUUID;
241
+ protocol: z.ZodLiteral<"edhspace.extension">;
242
+ apiVersion: z.ZodLiteral<1>;
243
+ sessionId: z.ZodUUID;
244
+ }, z.core.$strict>, z.ZodObject<{
245
+ method: z.ZodLiteral<"cards.search">;
246
+ params: z.ZodObject<{
247
+ query: z.ZodString;
248
+ page: z.ZodNumber;
249
+ }, z.core.$strict>;
250
+ type: z.ZodLiteral<"request">;
251
+ id: z.ZodUUID;
252
+ protocol: z.ZodLiteral<"edhspace.extension">;
253
+ apiVersion: z.ZodLiteral<1>;
254
+ sessionId: z.ZodUUID;
255
+ }, z.core.$strict>, z.ZodObject<{
256
+ method: z.ZodLiteral<"cards.get">;
257
+ params: z.ZodObject<{
258
+ name: z.ZodString;
259
+ }, z.core.$strict>;
260
+ type: z.ZodLiteral<"request">;
261
+ id: z.ZodUUID;
262
+ protocol: z.ZodLiteral<"edhspace.extension">;
263
+ apiVersion: z.ZodLiteral<1>;
264
+ sessionId: z.ZodUUID;
265
+ }, z.core.$strict>, z.ZodObject<{
266
+ method: z.ZodLiteral<"workspace.open">;
267
+ params: z.ZodObject<{
268
+ panelId: z.ZodString;
269
+ location: z.ZodEnum<{
270
+ workspace: "workspace";
271
+ sidebar: "sidebar";
272
+ }>;
273
+ }, z.core.$strict>;
274
+ type: z.ZodLiteral<"request">;
275
+ id: z.ZodUUID;
276
+ protocol: z.ZodLiteral<"edhspace.extension">;
277
+ apiVersion: z.ZodLiteral<1>;
278
+ sessionId: z.ZodUUID;
279
+ }, z.core.$strict>, z.ZodObject<{
280
+ method: z.ZodLiteral<"notifications.show">;
281
+ params: z.ZodObject<{
282
+ message: z.ZodString;
283
+ kind: z.ZodEnum<{
284
+ success: "success";
285
+ error: "error";
286
+ info: "info";
287
+ }>;
288
+ }, z.core.$strict>;
289
+ type: z.ZodLiteral<"request">;
290
+ id: z.ZodUUID;
291
+ protocol: z.ZodLiteral<"edhspace.extension">;
292
+ apiVersion: z.ZodLiteral<1>;
293
+ sessionId: z.ZodUUID;
294
+ }, z.core.$strict>, z.ZodObject<{
295
+ method: z.ZodLiteral<"storage.get">;
296
+ params: z.ZodObject<{
297
+ key: z.ZodString;
298
+ }, z.core.$strict>;
299
+ type: z.ZodLiteral<"request">;
300
+ id: z.ZodUUID;
301
+ protocol: z.ZodLiteral<"edhspace.extension">;
302
+ apiVersion: z.ZodLiteral<1>;
303
+ sessionId: z.ZodUUID;
304
+ }, z.core.$strict>, z.ZodObject<{
305
+ method: z.ZodLiteral<"storage.set">;
306
+ params: z.ZodObject<{
307
+ key: z.ZodString;
308
+ value: z.ZodJSONSchema;
309
+ }, z.core.$strict>;
310
+ type: z.ZodLiteral<"request">;
311
+ id: z.ZodUUID;
312
+ protocol: z.ZodLiteral<"edhspace.extension">;
313
+ apiVersion: z.ZodLiteral<1>;
314
+ sessionId: z.ZodUUID;
315
+ }, z.core.$strict>, z.ZodObject<{
316
+ method: z.ZodLiteral<"preferences.get">;
317
+ params: z.ZodObject<{}, z.core.$strict>;
318
+ type: z.ZodLiteral<"request">;
319
+ id: z.ZodUUID;
320
+ protocol: z.ZodLiteral<"edhspace.extension">;
321
+ apiVersion: z.ZodLiteral<1>;
322
+ sessionId: z.ZodUUID;
323
+ }, z.core.$strict>, z.ZodObject<{
324
+ method: z.ZodLiteral<"preferences.set">;
325
+ params: z.ZodObject<{
326
+ key: z.ZodString;
327
+ value: z.ZodJSONSchema;
328
+ }, z.core.$strict>;
329
+ type: z.ZodLiteral<"request">;
330
+ id: z.ZodUUID;
331
+ protocol: z.ZodLiteral<"edhspace.extension">;
332
+ apiVersion: z.ZodLiteral<1>;
333
+ sessionId: z.ZodUUID;
334
+ }, z.core.$strict>], "method">;
335
+ type ExtensionRequest = z.infer<typeof requestSchema>;
336
+ type ExtensionMethod = ExtensionRequest["method"];
337
+ type ExtensionArguments = {
338
+ [K in ExtensionMethod]: Extract<ExtensionRequest, {
339
+ method: K;
340
+ }>["params"];
341
+ };
342
+ declare const resultSchemas: {
343
+ "network.request": z.ZodObject<{
344
+ status: z.ZodNumber;
345
+ data: z.ZodJSONSchema;
346
+ }, z.core.$strict>;
347
+ "deck.read": z.ZodObject<{
348
+ id: z.ZodUUID;
349
+ name: z.ZodString;
350
+ format: z.ZodString;
351
+ revision: z.ZodString;
352
+ cards: z.ZodArray<z.ZodObject<{
353
+ id: z.ZodString;
354
+ name: z.ZodString;
355
+ quantity: z.ZodNumber;
356
+ manaCost: z.ZodOptional<z.ZodString>;
357
+ manaValue: z.ZodOptional<z.ZodNumber>;
358
+ typeLine: z.ZodOptional<z.ZodString>;
359
+ commander: z.ZodOptional<z.ZodBoolean>;
360
+ }, z.core.$strict>>;
361
+ }, z.core.$strict>;
362
+ "selection.read": z.ZodArray<z.ZodObject<{
363
+ id: z.ZodString;
364
+ name: z.ZodString;
365
+ quantity: z.ZodNumber;
366
+ manaCost: z.ZodOptional<z.ZodString>;
367
+ manaValue: z.ZodOptional<z.ZodNumber>;
368
+ typeLine: z.ZodOptional<z.ZodString>;
369
+ commander: z.ZodOptional<z.ZodBoolean>;
370
+ }, z.core.$strict>>;
371
+ "deck.propose": z.ZodDiscriminatedUnion<[z.ZodObject<{
372
+ id: z.ZodUUID;
373
+ status: z.ZodEnum<{
374
+ pending: "pending";
375
+ dismissed: "dismissed";
376
+ }>;
377
+ revision: z.ZodOptional<z.ZodString>;
378
+ undoId: z.ZodOptional<z.ZodUUID>;
379
+ }, z.core.$strict>, z.ZodObject<{
380
+ id: z.ZodUUID;
381
+ status: z.ZodLiteral<"applied">;
382
+ revision: z.ZodString;
383
+ undoId: z.ZodUUID;
384
+ }, z.core.$strict>], "status">;
385
+ "cards.inspect": z.ZodObject<{
386
+ opened: z.ZodLiteral<true>;
387
+ }, z.core.$strict>;
388
+ "cards.search": z.ZodObject<{
389
+ cards: z.ZodArray<z.ZodObject<{
390
+ id: z.ZodString;
391
+ name: z.ZodString;
392
+ quantity: z.ZodNumber;
393
+ manaCost: z.ZodOptional<z.ZodString>;
394
+ manaValue: z.ZodOptional<z.ZodNumber>;
395
+ typeLine: z.ZodOptional<z.ZodString>;
396
+ commander: z.ZodOptional<z.ZodBoolean>;
397
+ }, z.core.$strict>>;
398
+ nextPage: z.ZodOptional<z.ZodNumber>;
399
+ }, z.core.$strict>;
400
+ "cards.get": z.ZodNullable<z.ZodObject<{
401
+ id: z.ZodString;
402
+ name: z.ZodString;
403
+ quantity: z.ZodNumber;
404
+ manaCost: z.ZodOptional<z.ZodString>;
405
+ manaValue: z.ZodOptional<z.ZodNumber>;
406
+ typeLine: z.ZodOptional<z.ZodString>;
407
+ commander: z.ZodOptional<z.ZodBoolean>;
408
+ }, z.core.$strict>>;
409
+ "workspace.open": z.ZodObject<{
410
+ panelId: z.ZodString;
411
+ }, z.core.$strict>;
412
+ "notifications.show": z.ZodObject<{
413
+ shown: z.ZodLiteral<true>;
414
+ }, z.core.$strict>;
415
+ "storage.get": z.ZodJSONSchema;
416
+ "storage.set": z.ZodObject<{
417
+ saved: z.ZodLiteral<true>;
418
+ }, z.core.$strict>;
419
+ "preferences.get": z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
420
+ "preferences.set": z.ZodObject<{
421
+ saved: z.ZodLiteral<true>;
422
+ }, z.core.$strict>;
423
+ };
424
+ type ExtensionResults = {
425
+ [K in ExtensionMethod]: z.infer<(typeof resultSchemas)[K]>;
426
+ };
427
+ declare const errorCodeSchema: z.ZodEnum<{
428
+ invalid: "invalid";
429
+ denied: "denied";
430
+ revoked: "revoked";
431
+ unavailable: "unavailable";
432
+ "rate-limited": "rate-limited";
433
+ replayed: "replayed";
434
+ timeout: "timeout";
435
+ disconnected: "disconnected";
436
+ }>;
437
+ type ExtensionErrorCode = z.infer<typeof errorCodeSchema>;
438
+ declare class ExtensionError extends Error {
439
+ readonly code: ExtensionErrorCode;
440
+ constructor(message: string, code: ExtensionErrorCode);
441
+ }
442
+ declare const responseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
443
+ type: z.ZodLiteral<"response">;
444
+ id: z.ZodUUID;
445
+ ok: z.ZodLiteral<true>;
446
+ result: z.ZodUnknown;
447
+ protocol: z.ZodLiteral<"edhspace.extension">;
448
+ apiVersion: z.ZodLiteral<1>;
449
+ sessionId: z.ZodUUID;
450
+ }, z.core.$strict>, z.ZodObject<{
451
+ type: z.ZodLiteral<"response">;
452
+ id: z.ZodUUID;
453
+ ok: z.ZodLiteral<false>;
454
+ error: z.ZodObject<{
455
+ code: z.ZodEnum<{
456
+ invalid: "invalid";
457
+ denied: "denied";
458
+ revoked: "revoked";
459
+ unavailable: "unavailable";
460
+ "rate-limited": "rate-limited";
461
+ replayed: "replayed";
462
+ timeout: "timeout";
463
+ disconnected: "disconnected";
464
+ }>;
465
+ message: z.ZodString;
466
+ }, z.core.$strict>;
467
+ protocol: z.ZodLiteral<"edhspace.extension">;
468
+ apiVersion: z.ZodLiteral<1>;
469
+ sessionId: z.ZodUUID;
470
+ }, z.core.$strict>], "ok">;
471
+ type ExtensionResponse = z.infer<typeof responseSchema>;
472
+ type ExtensionInvoker = (request: ExtensionRequest) => Promise<ExtensionResponse>;
473
+
474
+ export { type DeckOperation as D, type ExtensionManifest as E, type NetworkEndpoint as N, type ProposalReceipt as P, type ExtensionArguments as a, type ExtensionResults as b, type ExtensionMethod as c, type ExtensionPermission as d, type ExtensionResponse as e, extensionManifestSchema as f, type ExtensionTheme as g, apiVersion as h, ExtensionError as i, type ExtensionCard as j, type ExtensionDeck as k, type ExtensionErrorCode as l, type ExtensionRequest as m, type ExtensionInvoker as n, type NetworkRequest as o };