@mondarth/fvtt-package-catalogue-contract 0.4.1 → 0.6.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/README.md +1 -1
- package/dist/api.d.ts +23 -326
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +23 -69
- package/dist/api.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/v2.d.ts +51 -1
- package/dist/v2.d.ts.map +1 -1
- package/dist/v2.js +39 -2
- package/dist/v2.js.map +1 -1
- package/package.json +5 -8
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @mondarth/fvtt-package-catalogue-contract
|
|
2
2
|
|
|
3
|
-
The API contract of the [Foundry VTT package catalogue](https://github.
|
|
3
|
+
The API contract of the [Foundry VTT package catalogue](https://mondarth.github.io/fvtt-package-catalogue/): a [zod](https://zod.dev) schema, and its TypeScript type, for every request and response of the catalogue's API.
|
|
4
4
|
|
|
5
5
|
> **Not ready for use.** Releases before 1.0.0 may change anything.
|
|
6
6
|
|
package/dist/api.d.ts
CHANGED
|
@@ -1,149 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The HTTP API
|
|
2
|
+
* The HTTP API, whatever its version: how to authenticate, and what every version's answers share. Each version's
|
|
3
|
+
* endpoints are in their own module (see `v2.ts`).
|
|
3
4
|
*/
|
|
4
5
|
import { z } from 'zod';
|
|
5
|
-
import { PackageRef } from './package.js';
|
|
6
|
-
/** The version of the API these schemas describe; part of every path. */
|
|
7
|
-
export declare const API_VERSION = "v1";
|
|
8
|
-
/** The path every endpoint of this API version is under. */
|
|
9
|
-
export declare const API_BASE = "/api/v1";
|
|
10
6
|
/**
|
|
11
|
-
* The header that carries the API key
|
|
12
|
-
*
|
|
7
|
+
* The header that carries the API key: one of the two ways an API request says who is asking, the other a signed-in
|
|
8
|
+
* user's token. Every API request needs one, except the CORS preflight. A key identifies a client rather than
|
|
9
|
+
* protecting the data, which is public; a module's key reaches only the endpoints a module needs.
|
|
13
10
|
*/
|
|
14
11
|
export declare const API_KEY_HEADER = "X-API-Key";
|
|
15
|
-
/** The header a client names itself and its version in, such as `EMMA/0.6.0`. Optional. */
|
|
16
|
-
export declare const CLIENT_HEADER = "X-Catalogue-Client";
|
|
17
12
|
/**
|
|
18
|
-
* The
|
|
19
|
-
*
|
|
20
|
-
* @param ref - The package
|
|
21
|
-
* @returns The path, under {@link API_BASE}
|
|
13
|
+
* The header that carries a signed-in user's token, as `Bearer <token>`: the other way an API request says who is
|
|
14
|
+
* asking. A user's token reaches every endpoint while they are subscribed, or an admin; `/me` at any time.
|
|
22
15
|
*/
|
|
23
|
-
export declare
|
|
24
|
-
/** The
|
|
25
|
-
export declare const
|
|
16
|
+
export declare const AUTHORIZATION_HEADER = "Authorization";
|
|
17
|
+
/** The header a client names itself and its version in, such as `EMMA/0.6.0`. Optional. */
|
|
18
|
+
export declare const CLIENT_HEADER = "X-Catalogue-Client";
|
|
26
19
|
/**
|
|
27
|
-
* The most packages a
|
|
28
|
-
*
|
|
29
|
-
*
|
|
20
|
+
* The most packages a lookup may start from: far more than the modules any world enables, which for a heavily modded
|
|
21
|
+
* world can be several hundred, while still refusing an absurd request before it is walked. What a lookup costs depends
|
|
22
|
+
* on its closure, not on how many packages it starts from.
|
|
30
23
|
*/
|
|
31
24
|
export declare const MAX_UNIVERSE_PACKAGES = 1000;
|
|
32
|
-
/**
|
|
33
|
-
export declare const
|
|
34
|
-
package: z.ZodObject<{
|
|
35
|
-
type: z.ZodEnum<{
|
|
36
|
-
module: "module";
|
|
37
|
-
system: "system";
|
|
38
|
-
world: "world";
|
|
39
|
-
}>;
|
|
40
|
-
id: z.ZodString;
|
|
41
|
-
}, z.core.$strip>;
|
|
42
|
-
releases: z.ZodArray<z.ZodObject<{
|
|
43
|
-
package: z.ZodObject<{
|
|
44
|
-
type: z.ZodEnum<{
|
|
45
|
-
module: "module";
|
|
46
|
-
system: "system";
|
|
47
|
-
world: "world";
|
|
48
|
-
}>;
|
|
49
|
-
id: z.ZodString;
|
|
50
|
-
}, z.core.$strip>;
|
|
51
|
-
version: z.ZodString;
|
|
52
|
-
compatibility: z.ZodObject<{
|
|
53
|
-
minimum: z.ZodExactOptional<z.ZodString>;
|
|
54
|
-
maximum: z.ZodExactOptional<z.ZodString>;
|
|
55
|
-
verified: z.ZodExactOptional<z.ZodString>;
|
|
56
|
-
}, z.core.$strip>;
|
|
57
|
-
relationships: z.ZodObject<{
|
|
58
|
-
requires: z.ZodArray<z.ZodObject<{
|
|
59
|
-
package: z.ZodObject<{
|
|
60
|
-
type: z.ZodEnum<{
|
|
61
|
-
module: "module";
|
|
62
|
-
system: "system";
|
|
63
|
-
world: "world";
|
|
64
|
-
}>;
|
|
65
|
-
id: z.ZodString;
|
|
66
|
-
}, z.core.$strip>;
|
|
67
|
-
compatibility: z.ZodObject<{
|
|
68
|
-
minimum: z.ZodExactOptional<z.ZodString>;
|
|
69
|
-
maximum: z.ZodExactOptional<z.ZodString>;
|
|
70
|
-
verified: z.ZodExactOptional<z.ZodString>;
|
|
71
|
-
}, z.core.$strip>;
|
|
72
|
-
manifest: z.ZodExactOptional<z.ZodURL>;
|
|
73
|
-
reason: z.ZodExactOptional<z.ZodString>;
|
|
74
|
-
}, z.core.$strip>>;
|
|
75
|
-
systems: z.ZodArray<z.ZodObject<{
|
|
76
|
-
package: z.ZodObject<{
|
|
77
|
-
type: z.ZodEnum<{
|
|
78
|
-
module: "module";
|
|
79
|
-
system: "system";
|
|
80
|
-
world: "world";
|
|
81
|
-
}>;
|
|
82
|
-
id: z.ZodString;
|
|
83
|
-
}, z.core.$strip>;
|
|
84
|
-
compatibility: z.ZodObject<{
|
|
85
|
-
minimum: z.ZodExactOptional<z.ZodString>;
|
|
86
|
-
maximum: z.ZodExactOptional<z.ZodString>;
|
|
87
|
-
verified: z.ZodExactOptional<z.ZodString>;
|
|
88
|
-
}, z.core.$strip>;
|
|
89
|
-
manifest: z.ZodExactOptional<z.ZodURL>;
|
|
90
|
-
reason: z.ZodExactOptional<z.ZodString>;
|
|
91
|
-
}, z.core.$strip>>;
|
|
92
|
-
conflicts: z.ZodArray<z.ZodObject<{
|
|
93
|
-
package: z.ZodObject<{
|
|
94
|
-
type: z.ZodEnum<{
|
|
95
|
-
module: "module";
|
|
96
|
-
system: "system";
|
|
97
|
-
world: "world";
|
|
98
|
-
}>;
|
|
99
|
-
id: z.ZodString;
|
|
100
|
-
}, z.core.$strip>;
|
|
101
|
-
compatibility: z.ZodObject<{
|
|
102
|
-
minimum: z.ZodExactOptional<z.ZodString>;
|
|
103
|
-
maximum: z.ZodExactOptional<z.ZodString>;
|
|
104
|
-
verified: z.ZodExactOptional<z.ZodString>;
|
|
105
|
-
}, z.core.$strip>;
|
|
106
|
-
manifest: z.ZodExactOptional<z.ZodURL>;
|
|
107
|
-
reason: z.ZodExactOptional<z.ZodString>;
|
|
108
|
-
}, z.core.$strip>>;
|
|
109
|
-
recommends: z.ZodArray<z.ZodObject<{
|
|
110
|
-
package: z.ZodObject<{
|
|
111
|
-
type: z.ZodEnum<{
|
|
112
|
-
module: "module";
|
|
113
|
-
system: "system";
|
|
114
|
-
world: "world";
|
|
115
|
-
}>;
|
|
116
|
-
id: z.ZodString;
|
|
117
|
-
}, z.core.$strip>;
|
|
118
|
-
compatibility: z.ZodObject<{
|
|
119
|
-
minimum: z.ZodExactOptional<z.ZodString>;
|
|
120
|
-
maximum: z.ZodExactOptional<z.ZodString>;
|
|
121
|
-
verified: z.ZodExactOptional<z.ZodString>;
|
|
122
|
-
}, z.core.$strip>;
|
|
123
|
-
manifest: z.ZodExactOptional<z.ZodURL>;
|
|
124
|
-
reason: z.ZodExactOptional<z.ZodString>;
|
|
125
|
-
}, z.core.$strip>>;
|
|
126
|
-
}, z.core.$strip>;
|
|
127
|
-
manifest: z.ZodExactOptional<z.ZodURL>;
|
|
128
|
-
download: z.ZodExactOptional<z.ZodURL>;
|
|
129
|
-
versionManifest: z.ZodExactOptional<z.ZodURL>;
|
|
130
|
-
protected: z.ZodBoolean;
|
|
131
|
-
origin: z.ZodString;
|
|
132
|
-
detail: z.ZodEnum<{
|
|
133
|
-
listed: "listed";
|
|
134
|
-
loaded: "loaded";
|
|
135
|
-
}>;
|
|
136
|
-
listing: z.ZodExactOptional<z.ZodObject<{
|
|
137
|
-
minimum: z.ZodExactOptional<z.ZodString>;
|
|
138
|
-
maximum: z.ZodExactOptional<z.ZodString>;
|
|
139
|
-
verified: z.ZodExactOptional<z.ZodString>;
|
|
140
|
-
}, z.core.$strip>>;
|
|
141
|
-
unlisted: z.ZodExactOptional<z.ZodBoolean>;
|
|
142
|
-
loadFailed: z.ZodExactOptional<z.ZodBoolean>;
|
|
143
|
-
}, z.core.$strip>>;
|
|
144
|
-
asOf: z.ZodNullable<z.ZodISODateTime>;
|
|
145
|
-
}, z.core.$strip>;
|
|
146
|
-
export type ReleasesResponse = z.infer<typeof ReleasesResponse>;
|
|
25
|
+
/** When the answer's data was last brought up to date, as an ISO 8601 time, or null if never. */
|
|
26
|
+
export declare const AsOf: z.ZodNullable<z.ZodISODateTime>;
|
|
147
27
|
/**
|
|
148
28
|
* Why a package cannot be had: `archived`, Foundry VTT's listing of it is archived, so its Setup screen no longer offers
|
|
149
29
|
* it; `gone`, its files are no longer there, as the catalogue's maintainers found.
|
|
@@ -170,176 +50,8 @@ export declare const UnavailablePackage: z.ZodObject<{
|
|
|
170
50
|
note: z.ZodExactOptional<z.ZodString>;
|
|
171
51
|
}, z.core.$strip>;
|
|
172
52
|
export type UnavailablePackage = z.infer<typeof UnavailablePackage>;
|
|
173
|
-
/**
|
|
174
|
-
export declare const
|
|
175
|
-
packages: z.ZodArray<z.ZodObject<{
|
|
176
|
-
type: z.ZodEnum<{
|
|
177
|
-
module: "module";
|
|
178
|
-
system: "system";
|
|
179
|
-
world: "world";
|
|
180
|
-
}>;
|
|
181
|
-
id: z.ZodString;
|
|
182
|
-
}, z.core.$strip>>;
|
|
183
|
-
}, z.core.$strip>;
|
|
184
|
-
export type UniverseRequest = z.infer<typeof UniverseRequest>;
|
|
185
|
-
/**
|
|
186
|
-
* `POST /api/v1/universe`: the packages asked for and every package their releases require or run in, as far as the
|
|
187
|
-
* catalogue holds them, with Foundry VTT's builds.
|
|
188
|
-
*/
|
|
189
|
-
export declare const UniverseResponse: z.ZodObject<{
|
|
190
|
-
universe: z.ZodObject<{
|
|
191
|
-
core: z.ZodArray<z.ZodObject<{
|
|
192
|
-
version: z.ZodString;
|
|
193
|
-
generation: z.ZodInt;
|
|
194
|
-
channel: z.ZodEnum<{
|
|
195
|
-
development: "development";
|
|
196
|
-
prototype: "prototype";
|
|
197
|
-
stable: "stable";
|
|
198
|
-
testing: "testing";
|
|
199
|
-
}>;
|
|
200
|
-
}, z.core.$strip>>;
|
|
201
|
-
releases: z.ZodArray<z.ZodObject<{
|
|
202
|
-
package: z.ZodObject<{
|
|
203
|
-
type: z.ZodEnum<{
|
|
204
|
-
module: "module";
|
|
205
|
-
system: "system";
|
|
206
|
-
world: "world";
|
|
207
|
-
}>;
|
|
208
|
-
id: z.ZodString;
|
|
209
|
-
}, z.core.$strip>;
|
|
210
|
-
version: z.ZodString;
|
|
211
|
-
compatibility: z.ZodObject<{
|
|
212
|
-
minimum: z.ZodExactOptional<z.ZodString>;
|
|
213
|
-
maximum: z.ZodExactOptional<z.ZodString>;
|
|
214
|
-
verified: z.ZodExactOptional<z.ZodString>;
|
|
215
|
-
}, z.core.$strip>;
|
|
216
|
-
relationships: z.ZodObject<{
|
|
217
|
-
requires: z.ZodArray<z.ZodObject<{
|
|
218
|
-
package: z.ZodObject<{
|
|
219
|
-
type: z.ZodEnum<{
|
|
220
|
-
module: "module";
|
|
221
|
-
system: "system";
|
|
222
|
-
world: "world";
|
|
223
|
-
}>;
|
|
224
|
-
id: z.ZodString;
|
|
225
|
-
}, z.core.$strip>;
|
|
226
|
-
compatibility: z.ZodObject<{
|
|
227
|
-
minimum: z.ZodExactOptional<z.ZodString>;
|
|
228
|
-
maximum: z.ZodExactOptional<z.ZodString>;
|
|
229
|
-
verified: z.ZodExactOptional<z.ZodString>;
|
|
230
|
-
}, z.core.$strip>;
|
|
231
|
-
manifest: z.ZodExactOptional<z.ZodURL>;
|
|
232
|
-
reason: z.ZodExactOptional<z.ZodString>;
|
|
233
|
-
}, z.core.$strip>>;
|
|
234
|
-
systems: z.ZodArray<z.ZodObject<{
|
|
235
|
-
package: z.ZodObject<{
|
|
236
|
-
type: z.ZodEnum<{
|
|
237
|
-
module: "module";
|
|
238
|
-
system: "system";
|
|
239
|
-
world: "world";
|
|
240
|
-
}>;
|
|
241
|
-
id: z.ZodString;
|
|
242
|
-
}, z.core.$strip>;
|
|
243
|
-
compatibility: z.ZodObject<{
|
|
244
|
-
minimum: z.ZodExactOptional<z.ZodString>;
|
|
245
|
-
maximum: z.ZodExactOptional<z.ZodString>;
|
|
246
|
-
verified: z.ZodExactOptional<z.ZodString>;
|
|
247
|
-
}, z.core.$strip>;
|
|
248
|
-
manifest: z.ZodExactOptional<z.ZodURL>;
|
|
249
|
-
reason: z.ZodExactOptional<z.ZodString>;
|
|
250
|
-
}, z.core.$strip>>;
|
|
251
|
-
conflicts: z.ZodArray<z.ZodObject<{
|
|
252
|
-
package: z.ZodObject<{
|
|
253
|
-
type: z.ZodEnum<{
|
|
254
|
-
module: "module";
|
|
255
|
-
system: "system";
|
|
256
|
-
world: "world";
|
|
257
|
-
}>;
|
|
258
|
-
id: z.ZodString;
|
|
259
|
-
}, z.core.$strip>;
|
|
260
|
-
compatibility: z.ZodObject<{
|
|
261
|
-
minimum: z.ZodExactOptional<z.ZodString>;
|
|
262
|
-
maximum: z.ZodExactOptional<z.ZodString>;
|
|
263
|
-
verified: z.ZodExactOptional<z.ZodString>;
|
|
264
|
-
}, z.core.$strip>;
|
|
265
|
-
manifest: z.ZodExactOptional<z.ZodURL>;
|
|
266
|
-
reason: z.ZodExactOptional<z.ZodString>;
|
|
267
|
-
}, z.core.$strip>>;
|
|
268
|
-
recommends: z.ZodArray<z.ZodObject<{
|
|
269
|
-
package: z.ZodObject<{
|
|
270
|
-
type: z.ZodEnum<{
|
|
271
|
-
module: "module";
|
|
272
|
-
system: "system";
|
|
273
|
-
world: "world";
|
|
274
|
-
}>;
|
|
275
|
-
id: z.ZodString;
|
|
276
|
-
}, z.core.$strip>;
|
|
277
|
-
compatibility: z.ZodObject<{
|
|
278
|
-
minimum: z.ZodExactOptional<z.ZodString>;
|
|
279
|
-
maximum: z.ZodExactOptional<z.ZodString>;
|
|
280
|
-
verified: z.ZodExactOptional<z.ZodString>;
|
|
281
|
-
}, z.core.$strip>;
|
|
282
|
-
manifest: z.ZodExactOptional<z.ZodURL>;
|
|
283
|
-
reason: z.ZodExactOptional<z.ZodString>;
|
|
284
|
-
}, z.core.$strip>>;
|
|
285
|
-
}, z.core.$strip>;
|
|
286
|
-
manifest: z.ZodExactOptional<z.ZodURL>;
|
|
287
|
-
download: z.ZodExactOptional<z.ZodURL>;
|
|
288
|
-
versionManifest: z.ZodExactOptional<z.ZodURL>;
|
|
289
|
-
protected: z.ZodBoolean;
|
|
290
|
-
origin: z.ZodString;
|
|
291
|
-
detail: z.ZodEnum<{
|
|
292
|
-
listed: "listed";
|
|
293
|
-
loaded: "loaded";
|
|
294
|
-
}>;
|
|
295
|
-
listing: z.ZodExactOptional<z.ZodObject<{
|
|
296
|
-
minimum: z.ZodExactOptional<z.ZodString>;
|
|
297
|
-
maximum: z.ZodExactOptional<z.ZodString>;
|
|
298
|
-
verified: z.ZodExactOptional<z.ZodString>;
|
|
299
|
-
}, z.core.$strip>>;
|
|
300
|
-
unlisted: z.ZodExactOptional<z.ZodBoolean>;
|
|
301
|
-
loadFailed: z.ZodExactOptional<z.ZodBoolean>;
|
|
302
|
-
}, z.core.$strip>>;
|
|
303
|
-
}, z.core.$strip>;
|
|
304
|
-
gaps: z.ZodArray<z.ZodObject<{
|
|
305
|
-
source: z.ZodString;
|
|
306
|
-
url: z.ZodString;
|
|
307
|
-
reason: z.ZodEnum<{
|
|
308
|
-
budget: "budget";
|
|
309
|
-
http: "http";
|
|
310
|
-
invalid: "invalid";
|
|
311
|
-
network: "network";
|
|
312
|
-
}>;
|
|
313
|
-
status: z.ZodExactOptional<z.ZodInt>;
|
|
314
|
-
package: z.ZodExactOptional<z.ZodString>;
|
|
315
|
-
version: z.ZodExactOptional<z.ZodString>;
|
|
316
|
-
}, z.core.$strip>>;
|
|
317
|
-
pending: z.ZodArray<z.ZodObject<{
|
|
318
|
-
type: z.ZodEnum<{
|
|
319
|
-
module: "module";
|
|
320
|
-
system: "system";
|
|
321
|
-
world: "world";
|
|
322
|
-
}>;
|
|
323
|
-
id: z.ZodString;
|
|
324
|
-
}, z.core.$strip>>;
|
|
325
|
-
unavailable: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
326
|
-
package: z.ZodObject<{
|
|
327
|
-
type: z.ZodEnum<{
|
|
328
|
-
module: "module";
|
|
329
|
-
system: "system";
|
|
330
|
-
world: "world";
|
|
331
|
-
}>;
|
|
332
|
-
id: z.ZodString;
|
|
333
|
-
}, z.core.$strip>;
|
|
334
|
-
reason: z.ZodEnum<{
|
|
335
|
-
archived: "archived";
|
|
336
|
-
gone: "gone";
|
|
337
|
-
}>;
|
|
338
|
-
note: z.ZodExactOptional<z.ZodString>;
|
|
339
|
-
}, z.core.$strip>>>;
|
|
340
|
-
asOf: z.ZodNullable<z.ZodISODateTime>;
|
|
341
|
-
}, z.core.$strip>;
|
|
342
|
-
export type UniverseResponse = z.infer<typeof UniverseResponse>;
|
|
53
|
+
/** A count of none or more. */
|
|
54
|
+
export declare const Count: z.ZodInt;
|
|
343
55
|
/**
|
|
344
56
|
* How what the catalogue holds compares with Foundry VTT's index, as the catalogue last checked, once a day. Each count
|
|
345
57
|
* but the first two is of something to put right; the catalogue queues the packages concerned to be crawled again.
|
|
@@ -356,27 +68,7 @@ export declare const ConsistencyReport: z.ZodObject<{
|
|
|
356
68
|
requeued: z.ZodInt;
|
|
357
69
|
}, z.core.$strip>;
|
|
358
70
|
export type ConsistencyReport = z.infer<typeof ConsistencyReport>;
|
|
359
|
-
/** `GET /
|
|
360
|
-
export declare const StatusResponse: z.ZodObject<{
|
|
361
|
-
apiVersion: z.ZodLiteral<"v1">;
|
|
362
|
-
version: z.ZodString;
|
|
363
|
-
packages: z.ZodInt;
|
|
364
|
-
releases: z.ZodInt;
|
|
365
|
-
asOf: z.ZodNullable<z.ZodISODateTime>;
|
|
366
|
-
consistency: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
367
|
-
at: z.ZodISODateTime;
|
|
368
|
-
listed: z.ZodInt;
|
|
369
|
-
held: z.ZodInt;
|
|
370
|
-
versionsMissing: z.ZodInt;
|
|
371
|
-
latestMissing: z.ZodInt;
|
|
372
|
-
listingsDiffer: z.ZodInt;
|
|
373
|
-
archivedHeld: z.ZodInt;
|
|
374
|
-
ownMissing: z.ZodInt;
|
|
375
|
-
requeued: z.ZodInt;
|
|
376
|
-
}, z.core.$strip>>>;
|
|
377
|
-
}, z.core.$strip>;
|
|
378
|
-
export type StatusResponse = z.infer<typeof StatusResponse>;
|
|
379
|
-
/** `GET /healthz`: the server is up. It is not under {@link API_BASE}, and needs no key. */
|
|
71
|
+
/** `GET /healthz`: the server is up. It is under no version of the API, and needs no key. */
|
|
380
72
|
export declare const HealthResponse: z.ZodObject<{
|
|
381
73
|
status: z.ZodLiteral<"ok">;
|
|
382
74
|
}, z.core.$strip>;
|
|
@@ -384,10 +76,12 @@ export type HealthResponse = z.infer<typeof HealthResponse>;
|
|
|
384
76
|
/** Why a request failed. */
|
|
385
77
|
export declare const ErrorCode: z.ZodEnum<{
|
|
386
78
|
"bad-request": "bad-request";
|
|
79
|
+
forbidden: "forbidden";
|
|
387
80
|
internal: "internal";
|
|
388
81
|
"method-not-allowed": "method-not-allowed";
|
|
389
82
|
"not-found": "not-found";
|
|
390
83
|
"rate-limited": "rate-limited";
|
|
84
|
+
"subscription-required": "subscription-required";
|
|
391
85
|
unauthorised: "unauthorised";
|
|
392
86
|
unavailable: "unavailable";
|
|
393
87
|
}>;
|
|
@@ -397,15 +91,18 @@ export declare const ErrorResponse: z.ZodObject<{
|
|
|
397
91
|
error: z.ZodObject<{
|
|
398
92
|
code: z.ZodEnum<{
|
|
399
93
|
"bad-request": "bad-request";
|
|
94
|
+
forbidden: "forbidden";
|
|
400
95
|
internal: "internal";
|
|
401
96
|
"method-not-allowed": "method-not-allowed";
|
|
402
97
|
"not-found": "not-found";
|
|
403
98
|
"rate-limited": "rate-limited";
|
|
99
|
+
"subscription-required": "subscription-required";
|
|
404
100
|
unauthorised: "unauthorised";
|
|
405
101
|
unavailable: "unavailable";
|
|
406
102
|
}>;
|
|
407
103
|
message: z.ZodString;
|
|
408
104
|
requestId: z.ZodExactOptional<z.ZodString>;
|
|
105
|
+
paidUntil: z.ZodExactOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
409
106
|
}, z.core.$strip>;
|
|
410
107
|
}, z.core.$strip>;
|
|
411
108
|
export type ErrorResponse = z.infer<typeof ErrorResponse>;
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;GAIG;AACH,eAAO,MAAM,cAAc,cAAc,CAAC;AAE1C;;;GAGG;AACH,eAAO,MAAM,oBAAoB,kBAAkB,CAAC;AAEpD,2FAA2F;AAC3F,eAAO,MAAM,aAAa,uBAAuB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAE1C,iGAAiG;AACjG,eAAO,MAAM,IAAI,iCAA8B,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;EAA+B,CAAC;AAC9D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;iBAK7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,+BAA+B;AAC/B,eAAO,MAAM,KAAK,UAAwB,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;iBAmB5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,6FAA6F;AAC7F,eAAO,MAAM,cAAc;;iBAEzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,4BAA4B;AAC5B,eAAO,MAAM,SAAS;;;;;;;;;;EAapB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,wCAAwC;AACxC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;iBASxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
package/dist/api.js
CHANGED
|
@@ -1,46 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The HTTP API
|
|
2
|
+
* The HTTP API, whatever its version: how to authenticate, and what every version's answers share. Each version's
|
|
3
|
+
* endpoints are in their own module (see `v2.ts`).
|
|
3
4
|
*/
|
|
4
5
|
import { z } from 'zod';
|
|
5
6
|
import { PackageRef } from './package.js';
|
|
6
|
-
import { Release } from './release.js';
|
|
7
|
-
import { SourceGap, Universe } from './universe.js';
|
|
8
|
-
/** The version of the API these schemas describe; part of every path. */
|
|
9
|
-
export const API_VERSION = 'v1';
|
|
10
|
-
/** The path every endpoint of this API version is under. */
|
|
11
|
-
export const API_BASE = `/api/${API_VERSION}`;
|
|
12
7
|
/**
|
|
13
|
-
* The header that carries the API key
|
|
14
|
-
*
|
|
8
|
+
* The header that carries the API key: one of the two ways an API request says who is asking, the other a signed-in
|
|
9
|
+
* user's token. Every API request needs one, except the CORS preflight. A key identifies a client rather than
|
|
10
|
+
* protecting the data, which is public; a module's key reaches only the endpoints a module needs.
|
|
15
11
|
*/
|
|
16
12
|
export const API_KEY_HEADER = 'X-API-Key';
|
|
17
|
-
/** The header a client names itself and its version in, such as `EMMA/0.6.0`. Optional. */
|
|
18
|
-
export const CLIENT_HEADER = 'X-Catalogue-Client';
|
|
19
13
|
/**
|
|
20
|
-
* The
|
|
21
|
-
*
|
|
22
|
-
* @param ref - The package
|
|
23
|
-
* @returns The path, under {@link API_BASE}
|
|
14
|
+
* The header that carries a signed-in user's token, as `Bearer <token>`: the other way an API request says who is
|
|
15
|
+
* asking. A user's token reaches every endpoint while they are subscribed, or an admin; `/me` at any time.
|
|
24
16
|
*/
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/** The path of the universe: a set of packages and everything they need. */
|
|
29
|
-
export const UNIVERSE_PATH = `${API_BASE}/universe`;
|
|
17
|
+
export const AUTHORIZATION_HEADER = 'Authorization';
|
|
18
|
+
/** The header a client names itself and its version in, such as `EMMA/0.6.0`. Optional. */
|
|
19
|
+
export const CLIENT_HEADER = 'X-Catalogue-Client';
|
|
30
20
|
/**
|
|
31
|
-
* The most packages a
|
|
32
|
-
*
|
|
33
|
-
*
|
|
21
|
+
* The most packages a lookup may start from: far more than the modules any world enables, which for a heavily modded
|
|
22
|
+
* world can be several hundred, while still refusing an absurd request before it is walked. What a lookup costs depends
|
|
23
|
+
* on its closure, not on how many packages it starts from.
|
|
34
24
|
*/
|
|
35
25
|
export const MAX_UNIVERSE_PACKAGES = 1000;
|
|
36
26
|
/** When the answer's data was last brought up to date, as an ISO 8601 time, or null if never. */
|
|
37
|
-
const AsOf = z.iso.datetime().nullable();
|
|
38
|
-
/** `GET /api/v1/packages/:type/:id/releases`: every release of a package the catalogue knows. */
|
|
39
|
-
export const ReleasesResponse = z.object({
|
|
40
|
-
package: PackageRef,
|
|
41
|
-
releases: z.array(Release),
|
|
42
|
-
asOf: AsOf,
|
|
43
|
-
});
|
|
27
|
+
export const AsOf = z.iso.datetime().nullable();
|
|
44
28
|
/**
|
|
45
29
|
* Why a package cannot be had: `archived`, Foundry VTT's listing of it is archived, so its Setup screen no longer offers
|
|
46
30
|
* it; `gone`, its files are no longer there, as the catalogue's maintainers found.
|
|
@@ -53,34 +37,8 @@ export const UnavailablePackage = z.object({
|
|
|
53
37
|
/** More of why, in words, such as what the maintainers found. */
|
|
54
38
|
note: z.string().min(1).exactOptional(),
|
|
55
39
|
});
|
|
56
|
-
/** `POST /api/v1/universe`: the packages to start from, such as those a world has enabled. */
|
|
57
|
-
export const UniverseRequest = z.object({
|
|
58
|
-
packages: z.array(PackageRef).min(1).max(MAX_UNIVERSE_PACKAGES),
|
|
59
|
-
});
|
|
60
|
-
/**
|
|
61
|
-
* `POST /api/v1/universe`: the packages asked for and every package their releases require or run in, as far as the
|
|
62
|
-
* catalogue holds them, with Foundry VTT's builds.
|
|
63
|
-
*/
|
|
64
|
-
export const UniverseResponse = z.object({
|
|
65
|
-
universe: Universe,
|
|
66
|
-
/** What the catalogue's sources could not fetch or read for these packages. */
|
|
67
|
-
gaps: z.array(SourceGap),
|
|
68
|
-
/**
|
|
69
|
-
* Packages asked for or needed that the catalogue does not hold yet. They are queued for it to fetch; until then, a
|
|
70
|
-
* client finds them elsewhere, such as through EMMA's proxy.
|
|
71
|
-
*/
|
|
72
|
-
pending: z.array(PackageRef),
|
|
73
|
-
/**
|
|
74
|
-
* Packages asked for or needed that cannot be had, with no releases in the universe, and not followed further. A
|
|
75
|
-
* client should leave them out of what it resolves, rather than look for them elsewhere. None from a catalogue that
|
|
76
|
-
* predates it.
|
|
77
|
-
*/
|
|
78
|
-
unavailable: z.array(UnavailablePackage).default([]),
|
|
79
|
-
/** The oldest time any of the packages held was brought up to date. */
|
|
80
|
-
asOf: AsOf,
|
|
81
|
-
});
|
|
82
40
|
/** A count of none or more. */
|
|
83
|
-
const Count = z.int().nonnegative();
|
|
41
|
+
export const Count = z.int().nonnegative();
|
|
84
42
|
/**
|
|
85
43
|
* How what the catalogue holds compares with Foundry VTT's index, as the catalogue last checked, once a day. Each count
|
|
86
44
|
* but the first two is of something to put right; the catalogue queues the packages concerned to be crawled again.
|
|
@@ -105,25 +63,19 @@ export const ConsistencyReport = z.object({
|
|
|
105
63
|
/** The packages queued to be crawled again for these. */
|
|
106
64
|
requeued: Count,
|
|
107
65
|
});
|
|
108
|
-
/** `GET /
|
|
109
|
-
export const StatusResponse = z.object({
|
|
110
|
-
apiVersion: z.literal(API_VERSION),
|
|
111
|
-
/** The catalogue's own release. */
|
|
112
|
-
version: z.string(),
|
|
113
|
-
packages: Count,
|
|
114
|
-
releases: Count,
|
|
115
|
-
asOf: AsOf,
|
|
116
|
-
/** How it last compared with Foundry VTT's index; null if it never has, or predates the check. */
|
|
117
|
-
consistency: ConsistencyReport.nullable().default(null),
|
|
118
|
-
});
|
|
119
|
-
/** `GET /healthz`: the server is up. It is not under {@link API_BASE}, and needs no key. */
|
|
66
|
+
/** `GET /healthz`: the server is up. It is under no version of the API, and needs no key. */
|
|
120
67
|
export const HealthResponse = z.object({
|
|
121
68
|
status: z.literal('ok'),
|
|
122
69
|
});
|
|
123
70
|
/** Why a request failed. */
|
|
124
71
|
export const ErrorCode = z.enum([
|
|
125
72
|
'bad-request',
|
|
73
|
+
/** No key or token, or one the catalogue does not accept. */
|
|
126
74
|
'unauthorised',
|
|
75
|
+
/** A key or token the catalogue accepts, but not for this endpoint. */
|
|
76
|
+
'forbidden',
|
|
77
|
+
/** A user's token, whose subscription has ended or never was: `paidUntil` says when it ended. */
|
|
78
|
+
'subscription-required',
|
|
127
79
|
'not-found',
|
|
128
80
|
'method-not-allowed',
|
|
129
81
|
'rate-limited',
|
|
@@ -137,6 +89,8 @@ export const ErrorResponse = z.object({
|
|
|
137
89
|
message: z.string(),
|
|
138
90
|
/** Identifies the request in the server's logs. */
|
|
139
91
|
requestId: z.string().exactOptional(),
|
|
92
|
+
/** For `subscription-required`: when the subscription ended, as an ISO 8601 time; null if there never was one. */
|
|
93
|
+
paidUntil: z.iso.datetime().nullable().exactOptional(),
|
|
140
94
|
}),
|
|
141
95
|
});
|
|
142
96
|
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;AAE1C;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAEpD,2FAA2F;AAC3F,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAE1C,iGAAiG;AACjG,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC;AAEhD;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAG9D,6EAA6E;AAC7E,MAAM,CA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,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,mDAAmD;QACnD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,aAAa,EAAE;QACrC,kHAAkH;QAClH,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,aAAa,EAAE;KACvD,CAAC;CACH,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ export { PackageId, PackageRef, PackageType, packageKey } from './package.js';
|
|
|
9
9
|
export { Compatibility, Relationship, Relationships, Release, ReleaseDetail, Version } from './release.js';
|
|
10
10
|
export { CoreChannel, CoreRelease } from './core.js';
|
|
11
11
|
export { SourceGap, Universe } from './universe.js';
|
|
12
|
-
export {
|
|
13
|
-
export { API_V2_BASE, API_V2_VERSION, CORE_PATH, CoreResponse, LISTING_PATH, ListedPackage, ListedVersion, ListingResponse, LOOKUP_PATH, LookupPackage, LookupPackageRequest, LookupRequest, LookupResponse, OwnManifest, PackageRelease, PendingPackage, MANIFEST_PATH, MAX_RECHECK_PACKAGES, ManifestRequest, ManifestResponse, RECHECK_MIN_SECONDS, RECHECK_PATH, RecheckRequest, RecheckResponse, RecheckedPackage, } from './v2.js';
|
|
12
|
+
export { API_KEY_HEADER, AUTHORIZATION_HEADER, CLIENT_HEADER, ConsistencyReport, ErrorCode, ErrorResponse, HealthResponse, MAX_UNIVERSE_PACKAGES, UnavailablePackage, UnavailableReason, } from './api.js';
|
|
13
|
+
export { API_V2_BASE, API_V2_VERSION, CORE_PATH, CoreResponse, LISTING_PATH, ListedPackage, ListedVersion, ListingResponse, LOOKUP_PATH, LookupPackage, LookupPackageRequest, LookupRequest, LookupResponse, OwnManifest, PackageRelease, PendingPackage, MANIFEST_PATH, MAX_RECHECK_PACKAGES, ME_PATH, MeResponse, ManifestRequest, ManifestResponse, RECHECK_MIN_SECONDS, RECHECK_PATH, RecheckRequest, RecheckResponse, RecheckedPackage, Role, STATUS_PATH, StatusResponse, } from './v2.js';
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC3G,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC3G,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,WAAW,EACX,cAAc,EACd,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,eAAe,EACf,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,cAAc,EACd,WAAW,EACX,cAAc,EACd,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,OAAO,EACP,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,IAAI,EACJ,WAAW,EACX,cAAc,GACf,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,6 @@ export { PackageId, PackageRef, PackageType, packageKey } from './package.js';
|
|
|
9
9
|
export { Compatibility, Relationship, Relationships, Release, ReleaseDetail, Version } from './release.js';
|
|
10
10
|
export { CoreChannel, CoreRelease } from './core.js';
|
|
11
11
|
export { SourceGap, Universe } from './universe.js';
|
|
12
|
-
export {
|
|
13
|
-
export { API_V2_BASE, API_V2_VERSION, CORE_PATH, CoreResponse, LISTING_PATH, ListedPackage, ListedVersion, ListingResponse, LOOKUP_PATH, LookupPackage, LookupPackageRequest, LookupRequest, LookupResponse, OwnManifest, PackageRelease, PendingPackage, MANIFEST_PATH, MAX_RECHECK_PACKAGES, ManifestRequest, ManifestResponse, RECHECK_MIN_SECONDS, RECHECK_PATH, RecheckRequest, RecheckResponse, RecheckedPackage, } from './v2.js';
|
|
12
|
+
export { API_KEY_HEADER, AUTHORIZATION_HEADER, CLIENT_HEADER, ConsistencyReport, ErrorCode, ErrorResponse, HealthResponse, MAX_UNIVERSE_PACKAGES, UnavailablePackage, UnavailableReason, } from './api.js';
|
|
13
|
+
export { API_V2_BASE, API_V2_VERSION, CORE_PATH, CoreResponse, LISTING_PATH, ListedPackage, ListedVersion, ListingResponse, LOOKUP_PATH, LookupPackage, LookupPackageRequest, LookupRequest, LookupResponse, OwnManifest, PackageRelease, PendingPackage, MANIFEST_PATH, MAX_RECHECK_PACKAGES, ME_PATH, MeResponse, ManifestRequest, ManifestResponse, RECHECK_MIN_SECONDS, RECHECK_PATH, RecheckRequest, RecheckResponse, RecheckedPackage, Role, STATUS_PATH, StatusResponse, } from './v2.js';
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC3G,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC3G,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,WAAW,EACX,cAAc,EACd,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,eAAe,EACf,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,cAAc,EACd,WAAW,EACX,cAAc,EACd,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,OAAO,EACP,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,IAAI,EACJ,WAAW,EACX,cAAc,GACf,MAAM,SAAS,CAAC"}
|
package/dist/v2.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Version 2 of the HTTP API: answers shaped for clients that ask the catalogue alone, such as EMMA, as few times as
|
|
3
|
-
* they can. Version 1 is
|
|
3
|
+
* they can. Version 1 is retired.
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
/** The version of the API these schemas describe; part of every path. */
|
|
@@ -17,6 +17,10 @@ export declare const CORE_PATH = "/api/v2/core";
|
|
|
17
17
|
export declare const MANIFEST_PATH = "/api/v2/manifest";
|
|
18
18
|
/** The path that has packages' own manifests checked again now, as a client's "check live" asks. */
|
|
19
19
|
export declare const RECHECK_PATH = "/api/v2/recheck";
|
|
20
|
+
/** The path of what the catalogue holds. */
|
|
21
|
+
export declare const STATUS_PATH = "/api/v2/status";
|
|
22
|
+
/** The path of the signed-in user a token is for, and their subscription: for a user's token alone. */
|
|
23
|
+
export declare const ME_PATH = "/api/v2/me";
|
|
20
24
|
/** The most packages one recheck may ask for: those a user means to see fresh, not every package installed. */
|
|
21
25
|
export declare const MAX_RECHECK_PACKAGES = 50;
|
|
22
26
|
/**
|
|
@@ -752,4 +756,50 @@ export declare const ManifestResponse: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
752
756
|
problem: z.ZodLiteral<"not-manifest">;
|
|
753
757
|
}, z.core.$strip>]>;
|
|
754
758
|
export type ManifestResponse = z.infer<typeof ManifestResponse>;
|
|
759
|
+
/** `GET /api/v2/status`: what the catalogue holds. */
|
|
760
|
+
export declare const StatusResponse: z.ZodObject<{
|
|
761
|
+
apiVersion: z.ZodLiteral<"v2">;
|
|
762
|
+
version: z.ZodString;
|
|
763
|
+
packages: z.ZodInt;
|
|
764
|
+
releases: z.ZodInt;
|
|
765
|
+
asOf: z.ZodNullable<z.ZodISODateTime>;
|
|
766
|
+
consistency: z.ZodNullable<z.ZodObject<{
|
|
767
|
+
at: z.ZodISODateTime;
|
|
768
|
+
listed: z.ZodInt;
|
|
769
|
+
held: z.ZodInt;
|
|
770
|
+
versionsMissing: z.ZodInt;
|
|
771
|
+
latestMissing: z.ZodInt;
|
|
772
|
+
listingsDiffer: z.ZodInt;
|
|
773
|
+
archivedHeld: z.ZodInt;
|
|
774
|
+
ownMissing: z.ZodInt;
|
|
775
|
+
requeued: z.ZodInt;
|
|
776
|
+
}, z.core.$strip>>;
|
|
777
|
+
}, z.core.$strip>;
|
|
778
|
+
export type StatusResponse = z.infer<typeof StatusResponse>;
|
|
779
|
+
/** A user's role. */
|
|
780
|
+
export declare const Role: z.ZodEnum<{
|
|
781
|
+
admin: "admin";
|
|
782
|
+
user: "user";
|
|
783
|
+
}>;
|
|
784
|
+
export type Role = z.infer<typeof Role>;
|
|
785
|
+
/**
|
|
786
|
+
* `GET /api/v2/me`: who a user's token is for, and whether they may use the API, for a client to say so, such as to
|
|
787
|
+
* ask them to renew. It answers whether or not they are subscribed.
|
|
788
|
+
*/
|
|
789
|
+
export declare const MeResponse: z.ZodObject<{
|
|
790
|
+
user: z.ZodObject<{
|
|
791
|
+
handle: z.ZodString;
|
|
792
|
+
nickname: z.ZodNullable<z.ZodString>;
|
|
793
|
+
role: z.ZodEnum<{
|
|
794
|
+
admin: "admin";
|
|
795
|
+
user: "user";
|
|
796
|
+
}>;
|
|
797
|
+
}, z.core.$strip>;
|
|
798
|
+
subscription: z.ZodObject<{
|
|
799
|
+
paidUntil: z.ZodNullable<z.ZodISODateTime>;
|
|
800
|
+
active: z.ZodBoolean;
|
|
801
|
+
}, z.core.$strip>;
|
|
802
|
+
entitled: z.ZodBoolean;
|
|
803
|
+
}, z.core.$strip>;
|
|
804
|
+
export type MeResponse = z.infer<typeof MeResponse>;
|
|
755
805
|
//# sourceMappingURL=v2.d.ts.map
|
package/dist/v2.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../src/v2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,yEAAyE;AACzE,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,qDAAqD;AACrD,eAAO,MAAM,WAAW,YAA2B,CAAC;AAEpD,4FAA4F;AAC5F,eAAO,MAAM,WAAW,mBAA0B,CAAC;AAEnD,wGAAwG;AACxG,eAAO,MAAM,YAAY,oBAA2B,CAAC;AAErD,wCAAwC;AACxC,eAAO,MAAM,SAAS,iBAAwB,CAAC;AAE/C,kFAAkF;AAClF,eAAO,MAAM,aAAa,qBAA4B,CAAC;AAEvD,oGAAoG;AACpG,eAAO,MAAM,YAAY,oBAA2B,CAAC;AAErD,+GAA+G;AAC/G,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAKvC,8DAA8D;AAC9D,eAAO,MAAM,oBAAoB;;;;;;;;;iBAQ/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE,kFAAkF;AAClF,eAAO,MAAM,aAAa;;;;;;;;;;;;iBAOxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,qFAAqF;AACrF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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D;AACtD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;iBASzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,qBAAqB;AACrB,eAAO,MAAM,IAAI;;;EAA4B,CAAC;AAC9C,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;iBAerB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
package/dist/v2.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Version 2 of the HTTP API: answers shaped for clients that ask the catalogue alone, such as EMMA, as few times as
|
|
3
|
-
* they can. Version 1 is
|
|
3
|
+
* they can. Version 1 is retired.
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import { MAX_UNIVERSE_PACKAGES, UnavailablePackage } from './api.js';
|
|
6
|
+
import { AsOf, ConsistencyReport, Count, MAX_UNIVERSE_PACKAGES, UnavailablePackage } from './api.js';
|
|
7
7
|
import { CoreRelease } from './core.js';
|
|
8
8
|
import { PackageRef } from './package.js';
|
|
9
9
|
import { Release, Version } from './release.js';
|
|
@@ -21,6 +21,10 @@ export const CORE_PATH = `${API_V2_BASE}/core`;
|
|
|
21
21
|
export const MANIFEST_PATH = `${API_V2_BASE}/manifest`;
|
|
22
22
|
/** The path that has packages' own manifests checked again now, as a client's "check live" asks. */
|
|
23
23
|
export const RECHECK_PATH = `${API_V2_BASE}/recheck`;
|
|
24
|
+
/** The path of what the catalogue holds. */
|
|
25
|
+
export const STATUS_PATH = `${API_V2_BASE}/status`;
|
|
26
|
+
/** The path of the signed-in user a token is for, and their subscription: for a user's token alone. */
|
|
27
|
+
export const ME_PATH = `${API_V2_BASE}/me`;
|
|
24
28
|
/** The most packages one recheck may ask for: those a user means to see fresh, not every package installed. */
|
|
25
29
|
export const MAX_RECHECK_PACKAGES = 50;
|
|
26
30
|
/**
|
|
@@ -191,4 +195,37 @@ export const ManifestResponse = z.union([
|
|
|
191
195
|
z.object({ ok: z.literal(false), problem: z.literal('other-type'), type: z.enum(['module', 'system']) }),
|
|
192
196
|
z.object({ ok: z.literal(false), problem: z.literal('not-manifest') }),
|
|
193
197
|
]);
|
|
198
|
+
/** `GET /api/v2/status`: what the catalogue holds. */
|
|
199
|
+
export const StatusResponse = z.object({
|
|
200
|
+
apiVersion: z.literal(API_V2_VERSION),
|
|
201
|
+
/** The catalogue's own release. */
|
|
202
|
+
version: z.string(),
|
|
203
|
+
packages: Count,
|
|
204
|
+
releases: Count,
|
|
205
|
+
asOf: AsOf,
|
|
206
|
+
/** How it last compared with Foundry VTT's index; null if it never has. */
|
|
207
|
+
consistency: ConsistencyReport.nullable(),
|
|
208
|
+
});
|
|
209
|
+
/** A user's role. */
|
|
210
|
+
export const Role = z.enum(['user', 'admin']);
|
|
211
|
+
/**
|
|
212
|
+
* `GET /api/v2/me`: who a user's token is for, and whether they may use the API, for a client to say so, such as to
|
|
213
|
+
* ask them to renew. It answers whether or not they are subscribed.
|
|
214
|
+
*/
|
|
215
|
+
export const MeResponse = z.object({
|
|
216
|
+
user: z.object({
|
|
217
|
+
/** Their user id, three words and two digits, as the website shows it. */
|
|
218
|
+
handle: z.string(),
|
|
219
|
+
/** The name they chose to be shown by, if any. */
|
|
220
|
+
nickname: z.string().nullable(),
|
|
221
|
+
role: Role,
|
|
222
|
+
}),
|
|
223
|
+
subscription: z.object({
|
|
224
|
+
/** When it ends or ended, as an ISO 8601 time; null if there never was one. */
|
|
225
|
+
paidUntil: z.iso.datetime().nullable(),
|
|
226
|
+
active: z.boolean(),
|
|
227
|
+
}),
|
|
228
|
+
/** Whether the token reaches every endpoint: subscribed, or an admin. */
|
|
229
|
+
entitled: z.boolean(),
|
|
230
|
+
});
|
|
194
231
|
//# sourceMappingURL=v2.js.map
|
package/dist/v2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2.js","sourceRoot":"","sources":["../src/v2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"v2.js","sourceRoot":"","sources":["../src/v2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACrG,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEhD,yEAAyE;AACzE,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AAEnC,qDAAqD;AACrD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,cAAc,EAAE,CAAC;AAEpD,4FAA4F;AAC5F,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,WAAW,SAAS,CAAC;AAEnD,wGAAwG;AACxG,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,WAAW,UAAU,CAAC;AAErD,wCAAwC;AACxC,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,WAAW,OAAO,CAAC;AAE/C,kFAAkF;AAClF,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,WAAW,WAAW,CAAC;AAEvD,oGAAoG;AACpG,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,WAAW,UAAU,CAAC;AAErD,4CAA4C;AAC5C,MAAM,CAAC,M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AC,MAAM,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,0EAA0E;QAC1E,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,kDAAkD;QAClD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC/B,IAAI,EAAE,IAAI;KACX,CAAC;IACF,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC;QACrB,+EAA+E;QAC/E,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QACtC,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;KACpB,CAAC;IACF,yEAAyE;IACzE,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;CACtB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mondarth/fvtt-package-catalogue-contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "The API contract of the Foundry VTT package catalogue: zod schemas and types of every request and response.",
|
|
5
5
|
"author": "Ulenar of Mondarth",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,15 +11,12 @@
|
|
|
11
11
|
"zod",
|
|
12
12
|
"api-contract"
|
|
13
13
|
],
|
|
14
|
-
"homepage": "https://github.
|
|
14
|
+
"homepage": "https://mondarth.github.io/fvtt-package-catalogue/",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
17
|
"url": "git+https://github.com/Mondarth/fvtt-package-catalogue.git",
|
|
18
18
|
"directory": "packages/contract"
|
|
19
19
|
},
|
|
20
|
-
"bugs": {
|
|
21
|
-
"url": "https://github.com/Mondarth/fvtt-package-catalogue/issues"
|
|
22
|
-
},
|
|
23
20
|
"exports": {
|
|
24
21
|
".": {
|
|
25
22
|
"@mondarth/fvtt-package-catalogue/source": "./src/index.ts",
|
|
@@ -42,12 +39,12 @@
|
|
|
42
39
|
"zod": "^4.6.7"
|
|
43
40
|
},
|
|
44
41
|
"devDependencies": {
|
|
45
|
-
"@mondarth/fvtt-resolver": "^0.
|
|
42
|
+
"@mondarth/fvtt-resolver": "^0.11.5",
|
|
46
43
|
"@types/node": "^24.19.2",
|
|
47
|
-
"@vitest/coverage-v8": "^5.0
|
|
44
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
48
45
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
49
46
|
"typescript7": "npm:typescript@^7.0.2",
|
|
50
|
-
"vitest": "^5.0
|
|
47
|
+
"vitest": "^5.1.0"
|
|
51
48
|
},
|
|
52
49
|
"scripts": {
|
|
53
50
|
"build": "tsc -p tsconfig.build.json",
|