@directus/extensions-registry 3.0.8 → 3.0.10
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/index.d.ts +162 -483
- package/dist/index.js +2 -2
- package/package.json +8 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as stream_web from 'stream/web';
|
|
2
|
-
import { ExtensionType } from '@directus/
|
|
2
|
+
import { ExtensionType } from '@directus/types';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
interface AccountOptions {
|
|
@@ -18,58 +18,48 @@ declare const RegistryAccountResponse: z.ZodObject<{
|
|
|
18
18
|
github_blog: z.ZodNullable<z.ZodString>;
|
|
19
19
|
github_location: z.ZodNullable<z.ZodString>;
|
|
20
20
|
github_bio: z.ZodNullable<z.ZodString>;
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
username: string;
|
|
24
|
-
verified: boolean;
|
|
25
|
-
github_username: string | null;
|
|
26
|
-
github_avatar_url: string | null;
|
|
27
|
-
github_name: string | null;
|
|
28
|
-
github_company: string | null;
|
|
29
|
-
github_blog: string | null;
|
|
30
|
-
github_location: string | null;
|
|
31
|
-
github_bio: string | null;
|
|
32
|
-
}, {
|
|
33
|
-
id: string;
|
|
34
|
-
username: string;
|
|
35
|
-
verified: boolean;
|
|
36
|
-
github_username: string | null;
|
|
37
|
-
github_avatar_url: string | null;
|
|
38
|
-
github_name: string | null;
|
|
39
|
-
github_company: string | null;
|
|
40
|
-
github_blog: string | null;
|
|
41
|
-
github_location: string | null;
|
|
42
|
-
github_bio: string | null;
|
|
43
|
-
}>;
|
|
44
|
-
}, "strip", z.ZodTypeAny, {
|
|
45
|
-
data: {
|
|
46
|
-
id: string;
|
|
47
|
-
username: string;
|
|
48
|
-
verified: boolean;
|
|
49
|
-
github_username: string | null;
|
|
50
|
-
github_avatar_url: string | null;
|
|
51
|
-
github_name: string | null;
|
|
52
|
-
github_company: string | null;
|
|
53
|
-
github_blog: string | null;
|
|
54
|
-
github_location: string | null;
|
|
55
|
-
github_bio: string | null;
|
|
56
|
-
};
|
|
57
|
-
}, {
|
|
58
|
-
data: {
|
|
59
|
-
id: string;
|
|
60
|
-
username: string;
|
|
61
|
-
verified: boolean;
|
|
62
|
-
github_username: string | null;
|
|
63
|
-
github_avatar_url: string | null;
|
|
64
|
-
github_name: string | null;
|
|
65
|
-
github_company: string | null;
|
|
66
|
-
github_blog: string | null;
|
|
67
|
-
github_location: string | null;
|
|
68
|
-
github_bio: string | null;
|
|
69
|
-
};
|
|
70
|
-
}>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
}, z.core.$strip>;
|
|
71
23
|
type RegistryAccountResponse = z.infer<typeof RegistryAccountResponse>;
|
|
72
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves account information from the extensions registry.
|
|
27
|
+
*
|
|
28
|
+
* This function fetches detailed account data for a specified user or organization
|
|
29
|
+
* from the Directus extensions registry. It validates API version compatibility
|
|
30
|
+
* and returns structured account information including profile details, published
|
|
31
|
+
* extensions, and other relevant metadata.
|
|
32
|
+
*
|
|
33
|
+
* @param id - The unique identifier of the account to retrieve (username or organization name)
|
|
34
|
+
* @param options - Optional configuration for the request
|
|
35
|
+
* @param options.registry - Custom registry URL to use instead of the default registry
|
|
36
|
+
* @returns Promise that resolves to validated account data from the registry
|
|
37
|
+
*
|
|
38
|
+
* @throws {Error} When API version compatibility check fails
|
|
39
|
+
* @throws {Error} When the account ID is not found in the registry
|
|
40
|
+
* @throws {Error} When network request fails or registry is unreachable
|
|
41
|
+
* @throws {Error} When response data fails validation against the expected schema
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* // Get account information using default registry
|
|
46
|
+
* const accountData = await account('directus');
|
|
47
|
+
* console.log(accountData.name); // Account name
|
|
48
|
+
* console.log(accountData.extensions); // Published extensions
|
|
49
|
+
*
|
|
50
|
+
* // Get account information from custom registry
|
|
51
|
+
* const customAccountData = await account('my-org', {
|
|
52
|
+
* registry: 'https://custom-registry.example.com'
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* // Handle errors
|
|
56
|
+
* try {
|
|
57
|
+
* const accountData = await account('non-existent-user');
|
|
58
|
+
* } catch (error) {
|
|
59
|
+
* console.error('Failed to fetch account:', error.message);
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
73
63
|
declare const account: (id: string, options?: AccountOptions) => Promise<{
|
|
74
64
|
data: {
|
|
75
65
|
id: string;
|
|
@@ -93,34 +83,50 @@ declare const RegistryDescribeResponse: z.ZodObject<{
|
|
|
93
83
|
data: z.ZodObject<{
|
|
94
84
|
id: z.ZodString;
|
|
95
85
|
name: z.ZodString;
|
|
96
|
-
description: z.ZodUnion<[z.ZodNull, z.ZodString]>;
|
|
86
|
+
description: z.ZodUnion<readonly [z.ZodNull, z.ZodString]>;
|
|
97
87
|
total_downloads: z.ZodNumber;
|
|
98
|
-
downloads: z.ZodUnion<[z.ZodNull, z.ZodArray<z.ZodObject<{
|
|
88
|
+
downloads: z.ZodUnion<readonly [z.ZodNull, z.ZodArray<z.ZodObject<{
|
|
99
89
|
date: z.ZodString;
|
|
100
90
|
count: z.ZodNumber;
|
|
101
|
-
},
|
|
102
|
-
date: string;
|
|
103
|
-
count: number;
|
|
104
|
-
}, {
|
|
105
|
-
date: string;
|
|
106
|
-
count: number;
|
|
107
|
-
}>, "many">]>;
|
|
91
|
+
}, z.core.$strip>>]>;
|
|
108
92
|
verified: z.ZodBoolean;
|
|
109
|
-
readme: z.ZodUnion<[z.ZodNull, z.ZodString]>;
|
|
110
|
-
type: z.ZodEnum<
|
|
93
|
+
readme: z.ZodUnion<readonly [z.ZodNull, z.ZodString]>;
|
|
94
|
+
type: z.ZodEnum<{
|
|
95
|
+
interface: "interface";
|
|
96
|
+
display: "display";
|
|
97
|
+
layout: "layout";
|
|
98
|
+
module: "module";
|
|
99
|
+
panel: "panel";
|
|
100
|
+
theme: "theme";
|
|
101
|
+
hook: "hook";
|
|
102
|
+
endpoint: "endpoint";
|
|
103
|
+
operation: "operation";
|
|
104
|
+
bundle: "bundle";
|
|
105
|
+
}>;
|
|
111
106
|
license: z.ZodNullable<z.ZodString>;
|
|
112
107
|
versions: z.ZodArray<z.ZodObject<{
|
|
113
108
|
id: z.ZodString;
|
|
114
109
|
version: z.ZodString;
|
|
115
110
|
verified: z.ZodBoolean;
|
|
116
|
-
type: z.ZodEnum<
|
|
111
|
+
type: z.ZodEnum<{
|
|
112
|
+
interface: "interface";
|
|
113
|
+
display: "display";
|
|
114
|
+
layout: "layout";
|
|
115
|
+
module: "module";
|
|
116
|
+
panel: "panel";
|
|
117
|
+
theme: "theme";
|
|
118
|
+
hook: "hook";
|
|
119
|
+
endpoint: "endpoint";
|
|
120
|
+
operation: "operation";
|
|
121
|
+
bundle: "bundle";
|
|
122
|
+
}>;
|
|
117
123
|
host_version: z.ZodString;
|
|
118
124
|
publish_date: z.ZodString;
|
|
119
125
|
unpacked_size: z.ZodNumber;
|
|
120
126
|
file_count: z.ZodNumber;
|
|
121
|
-
url_bugs: z.ZodUnion<[z.ZodNull, z.ZodString]>;
|
|
122
|
-
url_homepage: z.ZodUnion<[z.ZodNull, z.ZodString]>;
|
|
123
|
-
url_repository: z.ZodUnion<[z.ZodNull, z.ZodString]>;
|
|
127
|
+
url_bugs: z.ZodUnion<readonly [z.ZodNull, z.ZodString]>;
|
|
128
|
+
url_homepage: z.ZodUnion<readonly [z.ZodNull, z.ZodString]>;
|
|
129
|
+
url_repository: z.ZodUnion<readonly [z.ZodNull, z.ZodString]>;
|
|
124
130
|
license: z.ZodNullable<z.ZodString>;
|
|
125
131
|
publisher: z.ZodObject<{
|
|
126
132
|
id: z.ZodString;
|
|
@@ -128,29 +134,11 @@ declare const RegistryDescribeResponse: z.ZodObject<{
|
|
|
128
134
|
verified: z.ZodBoolean;
|
|
129
135
|
github_name: z.ZodNullable<z.ZodString>;
|
|
130
136
|
github_avatar_url: z.ZodNullable<z.ZodString>;
|
|
131
|
-
},
|
|
132
|
-
id: string;
|
|
133
|
-
username: string;
|
|
134
|
-
verified: boolean;
|
|
135
|
-
github_avatar_url: string | null;
|
|
136
|
-
github_name: string | null;
|
|
137
|
-
}, {
|
|
138
|
-
id: string;
|
|
139
|
-
username: string;
|
|
140
|
-
verified: boolean;
|
|
141
|
-
github_avatar_url: string | null;
|
|
142
|
-
github_name: string | null;
|
|
143
|
-
}>;
|
|
137
|
+
}, z.core.$strip>;
|
|
144
138
|
bundled: z.ZodArray<z.ZodObject<{
|
|
145
139
|
name: z.ZodString;
|
|
146
140
|
type: z.ZodString;
|
|
147
|
-
},
|
|
148
|
-
type: string;
|
|
149
|
-
name: string;
|
|
150
|
-
}, {
|
|
151
|
-
type: string;
|
|
152
|
-
name: string;
|
|
153
|
-
}>, "many">;
|
|
141
|
+
}, z.core.$strip>>;
|
|
154
142
|
maintainers: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
155
143
|
accounts_id: z.ZodObject<{
|
|
156
144
|
id: z.ZodString;
|
|
@@ -158,304 +146,16 @@ declare const RegistryDescribeResponse: z.ZodObject<{
|
|
|
158
146
|
verified: z.ZodBoolean;
|
|
159
147
|
github_name: z.ZodNullable<z.ZodString>;
|
|
160
148
|
github_avatar_url: z.ZodNullable<z.ZodString>;
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
github_name: string | null;
|
|
167
|
-
}, {
|
|
168
|
-
id: string;
|
|
169
|
-
username: string;
|
|
170
|
-
verified: boolean;
|
|
171
|
-
github_avatar_url: string | null;
|
|
172
|
-
github_name: string | null;
|
|
173
|
-
}>;
|
|
174
|
-
}, "strip", z.ZodTypeAny, {
|
|
175
|
-
accounts_id: {
|
|
176
|
-
id: string;
|
|
177
|
-
username: string;
|
|
178
|
-
verified: boolean;
|
|
179
|
-
github_avatar_url: string | null;
|
|
180
|
-
github_name: string | null;
|
|
181
|
-
};
|
|
182
|
-
}, {
|
|
183
|
-
accounts_id: {
|
|
184
|
-
id: string;
|
|
185
|
-
username: string;
|
|
186
|
-
verified: boolean;
|
|
187
|
-
github_avatar_url: string | null;
|
|
188
|
-
github_name: string | null;
|
|
189
|
-
};
|
|
190
|
-
}>, "many">>;
|
|
191
|
-
}, "strip", z.ZodTypeAny, {
|
|
192
|
-
version: string;
|
|
193
|
-
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
194
|
-
id: string;
|
|
195
|
-
verified: boolean;
|
|
196
|
-
license: string | null;
|
|
197
|
-
host_version: string;
|
|
198
|
-
publish_date: string;
|
|
199
|
-
unpacked_size: number;
|
|
200
|
-
file_count: number;
|
|
201
|
-
url_bugs: string | null;
|
|
202
|
-
url_homepage: string | null;
|
|
203
|
-
url_repository: string | null;
|
|
204
|
-
publisher: {
|
|
205
|
-
id: string;
|
|
206
|
-
username: string;
|
|
207
|
-
verified: boolean;
|
|
208
|
-
github_avatar_url: string | null;
|
|
209
|
-
github_name: string | null;
|
|
210
|
-
};
|
|
211
|
-
bundled: {
|
|
212
|
-
type: string;
|
|
213
|
-
name: string;
|
|
214
|
-
}[];
|
|
215
|
-
maintainers: {
|
|
216
|
-
accounts_id: {
|
|
217
|
-
id: string;
|
|
218
|
-
username: string;
|
|
219
|
-
verified: boolean;
|
|
220
|
-
github_avatar_url: string | null;
|
|
221
|
-
github_name: string | null;
|
|
222
|
-
};
|
|
223
|
-
}[] | null;
|
|
224
|
-
}, {
|
|
225
|
-
version: string;
|
|
226
|
-
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
227
|
-
id: string;
|
|
228
|
-
verified: boolean;
|
|
229
|
-
license: string | null;
|
|
230
|
-
host_version: string;
|
|
231
|
-
publish_date: string;
|
|
232
|
-
unpacked_size: number;
|
|
233
|
-
file_count: number;
|
|
234
|
-
url_bugs: string | null;
|
|
235
|
-
url_homepage: string | null;
|
|
236
|
-
url_repository: string | null;
|
|
237
|
-
publisher: {
|
|
238
|
-
id: string;
|
|
239
|
-
username: string;
|
|
240
|
-
verified: boolean;
|
|
241
|
-
github_avatar_url: string | null;
|
|
242
|
-
github_name: string | null;
|
|
243
|
-
};
|
|
244
|
-
bundled: {
|
|
245
|
-
type: string;
|
|
246
|
-
name: string;
|
|
247
|
-
}[];
|
|
248
|
-
maintainers: {
|
|
249
|
-
accounts_id: {
|
|
250
|
-
id: string;
|
|
251
|
-
username: string;
|
|
252
|
-
verified: boolean;
|
|
253
|
-
github_avatar_url: string | null;
|
|
254
|
-
github_name: string | null;
|
|
255
|
-
};
|
|
256
|
-
}[] | null;
|
|
257
|
-
}>, "many">;
|
|
258
|
-
}, "strip", z.ZodTypeAny, {
|
|
259
|
-
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
260
|
-
id: string;
|
|
261
|
-
verified: boolean;
|
|
262
|
-
name: string;
|
|
263
|
-
description: string | null;
|
|
264
|
-
total_downloads: number;
|
|
265
|
-
downloads: {
|
|
266
|
-
date: string;
|
|
267
|
-
count: number;
|
|
268
|
-
}[] | null;
|
|
269
|
-
readme: string | null;
|
|
270
|
-
license: string | null;
|
|
271
|
-
versions: {
|
|
272
|
-
version: string;
|
|
273
|
-
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
274
|
-
id: string;
|
|
275
|
-
verified: boolean;
|
|
276
|
-
license: string | null;
|
|
277
|
-
host_version: string;
|
|
278
|
-
publish_date: string;
|
|
279
|
-
unpacked_size: number;
|
|
280
|
-
file_count: number;
|
|
281
|
-
url_bugs: string | null;
|
|
282
|
-
url_homepage: string | null;
|
|
283
|
-
url_repository: string | null;
|
|
284
|
-
publisher: {
|
|
285
|
-
id: string;
|
|
286
|
-
username: string;
|
|
287
|
-
verified: boolean;
|
|
288
|
-
github_avatar_url: string | null;
|
|
289
|
-
github_name: string | null;
|
|
290
|
-
};
|
|
291
|
-
bundled: {
|
|
292
|
-
type: string;
|
|
293
|
-
name: string;
|
|
294
|
-
}[];
|
|
295
|
-
maintainers: {
|
|
296
|
-
accounts_id: {
|
|
297
|
-
id: string;
|
|
298
|
-
username: string;
|
|
299
|
-
verified: boolean;
|
|
300
|
-
github_avatar_url: string | null;
|
|
301
|
-
github_name: string | null;
|
|
302
|
-
};
|
|
303
|
-
}[] | null;
|
|
304
|
-
}[];
|
|
305
|
-
}, {
|
|
306
|
-
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
307
|
-
id: string;
|
|
308
|
-
verified: boolean;
|
|
309
|
-
name: string;
|
|
310
|
-
description: string | null;
|
|
311
|
-
total_downloads: number;
|
|
312
|
-
downloads: {
|
|
313
|
-
date: string;
|
|
314
|
-
count: number;
|
|
315
|
-
}[] | null;
|
|
316
|
-
readme: string | null;
|
|
317
|
-
license: string | null;
|
|
318
|
-
versions: {
|
|
319
|
-
version: string;
|
|
320
|
-
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
321
|
-
id: string;
|
|
322
|
-
verified: boolean;
|
|
323
|
-
license: string | null;
|
|
324
|
-
host_version: string;
|
|
325
|
-
publish_date: string;
|
|
326
|
-
unpacked_size: number;
|
|
327
|
-
file_count: number;
|
|
328
|
-
url_bugs: string | null;
|
|
329
|
-
url_homepage: string | null;
|
|
330
|
-
url_repository: string | null;
|
|
331
|
-
publisher: {
|
|
332
|
-
id: string;
|
|
333
|
-
username: string;
|
|
334
|
-
verified: boolean;
|
|
335
|
-
github_avatar_url: string | null;
|
|
336
|
-
github_name: string | null;
|
|
337
|
-
};
|
|
338
|
-
bundled: {
|
|
339
|
-
type: string;
|
|
340
|
-
name: string;
|
|
341
|
-
}[];
|
|
342
|
-
maintainers: {
|
|
343
|
-
accounts_id: {
|
|
344
|
-
id: string;
|
|
345
|
-
username: string;
|
|
346
|
-
verified: boolean;
|
|
347
|
-
github_avatar_url: string | null;
|
|
348
|
-
github_name: string | null;
|
|
349
|
-
};
|
|
350
|
-
}[] | null;
|
|
351
|
-
}[];
|
|
352
|
-
}>;
|
|
353
|
-
}, "strip", z.ZodTypeAny, {
|
|
354
|
-
data: {
|
|
355
|
-
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
356
|
-
id: string;
|
|
357
|
-
verified: boolean;
|
|
358
|
-
name: string;
|
|
359
|
-
description: string | null;
|
|
360
|
-
total_downloads: number;
|
|
361
|
-
downloads: {
|
|
362
|
-
date: string;
|
|
363
|
-
count: number;
|
|
364
|
-
}[] | null;
|
|
365
|
-
readme: string | null;
|
|
366
|
-
license: string | null;
|
|
367
|
-
versions: {
|
|
368
|
-
version: string;
|
|
369
|
-
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
370
|
-
id: string;
|
|
371
|
-
verified: boolean;
|
|
372
|
-
license: string | null;
|
|
373
|
-
host_version: string;
|
|
374
|
-
publish_date: string;
|
|
375
|
-
unpacked_size: number;
|
|
376
|
-
file_count: number;
|
|
377
|
-
url_bugs: string | null;
|
|
378
|
-
url_homepage: string | null;
|
|
379
|
-
url_repository: string | null;
|
|
380
|
-
publisher: {
|
|
381
|
-
id: string;
|
|
382
|
-
username: string;
|
|
383
|
-
verified: boolean;
|
|
384
|
-
github_avatar_url: string | null;
|
|
385
|
-
github_name: string | null;
|
|
386
|
-
};
|
|
387
|
-
bundled: {
|
|
388
|
-
type: string;
|
|
389
|
-
name: string;
|
|
390
|
-
}[];
|
|
391
|
-
maintainers: {
|
|
392
|
-
accounts_id: {
|
|
393
|
-
id: string;
|
|
394
|
-
username: string;
|
|
395
|
-
verified: boolean;
|
|
396
|
-
github_avatar_url: string | null;
|
|
397
|
-
github_name: string | null;
|
|
398
|
-
};
|
|
399
|
-
}[] | null;
|
|
400
|
-
}[];
|
|
401
|
-
};
|
|
402
|
-
}, {
|
|
403
|
-
data: {
|
|
404
|
-
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
405
|
-
id: string;
|
|
406
|
-
verified: boolean;
|
|
407
|
-
name: string;
|
|
408
|
-
description: string | null;
|
|
409
|
-
total_downloads: number;
|
|
410
|
-
downloads: {
|
|
411
|
-
date: string;
|
|
412
|
-
count: number;
|
|
413
|
-
}[] | null;
|
|
414
|
-
readme: string | null;
|
|
415
|
-
license: string | null;
|
|
416
|
-
versions: {
|
|
417
|
-
version: string;
|
|
418
|
-
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
419
|
-
id: string;
|
|
420
|
-
verified: boolean;
|
|
421
|
-
license: string | null;
|
|
422
|
-
host_version: string;
|
|
423
|
-
publish_date: string;
|
|
424
|
-
unpacked_size: number;
|
|
425
|
-
file_count: number;
|
|
426
|
-
url_bugs: string | null;
|
|
427
|
-
url_homepage: string | null;
|
|
428
|
-
url_repository: string | null;
|
|
429
|
-
publisher: {
|
|
430
|
-
id: string;
|
|
431
|
-
username: string;
|
|
432
|
-
verified: boolean;
|
|
433
|
-
github_avatar_url: string | null;
|
|
434
|
-
github_name: string | null;
|
|
435
|
-
};
|
|
436
|
-
bundled: {
|
|
437
|
-
type: string;
|
|
438
|
-
name: string;
|
|
439
|
-
}[];
|
|
440
|
-
maintainers: {
|
|
441
|
-
accounts_id: {
|
|
442
|
-
id: string;
|
|
443
|
-
username: string;
|
|
444
|
-
verified: boolean;
|
|
445
|
-
github_avatar_url: string | null;
|
|
446
|
-
github_name: string | null;
|
|
447
|
-
};
|
|
448
|
-
}[] | null;
|
|
449
|
-
}[];
|
|
450
|
-
};
|
|
451
|
-
}>;
|
|
149
|
+
}, z.core.$strip>;
|
|
150
|
+
}, z.core.$strip>>>;
|
|
151
|
+
}, z.core.$strip>>;
|
|
152
|
+
}, z.core.$strip>;
|
|
153
|
+
}, z.core.$strip>;
|
|
452
154
|
type RegistryDescribeResponse = z.infer<typeof RegistryDescribeResponse>;
|
|
453
155
|
|
|
454
156
|
declare const describe: (id: string, options?: DescribeOptions) => Promise<{
|
|
455
157
|
data: {
|
|
456
|
-
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
457
158
|
id: string;
|
|
458
|
-
verified: boolean;
|
|
459
159
|
name: string;
|
|
460
160
|
description: string | null;
|
|
461
161
|
total_downloads: number;
|
|
@@ -463,14 +163,15 @@ declare const describe: (id: string, options?: DescribeOptions) => Promise<{
|
|
|
463
163
|
date: string;
|
|
464
164
|
count: number;
|
|
465
165
|
}[] | null;
|
|
166
|
+
verified: boolean;
|
|
466
167
|
readme: string | null;
|
|
168
|
+
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
467
169
|
license: string | null;
|
|
468
170
|
versions: {
|
|
469
|
-
version: string;
|
|
470
|
-
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
471
171
|
id: string;
|
|
172
|
+
version: string;
|
|
472
173
|
verified: boolean;
|
|
473
|
-
|
|
174
|
+
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
474
175
|
host_version: string;
|
|
475
176
|
publish_date: string;
|
|
476
177
|
unpacked_size: number;
|
|
@@ -478,24 +179,25 @@ declare const describe: (id: string, options?: DescribeOptions) => Promise<{
|
|
|
478
179
|
url_bugs: string | null;
|
|
479
180
|
url_homepage: string | null;
|
|
480
181
|
url_repository: string | null;
|
|
182
|
+
license: string | null;
|
|
481
183
|
publisher: {
|
|
482
184
|
id: string;
|
|
483
185
|
username: string;
|
|
484
186
|
verified: boolean;
|
|
485
|
-
github_avatar_url: string | null;
|
|
486
187
|
github_name: string | null;
|
|
188
|
+
github_avatar_url: string | null;
|
|
487
189
|
};
|
|
488
190
|
bundled: {
|
|
489
|
-
type: string;
|
|
490
191
|
name: string;
|
|
192
|
+
type: string;
|
|
491
193
|
}[];
|
|
492
194
|
maintainers: {
|
|
493
195
|
accounts_id: {
|
|
494
196
|
id: string;
|
|
495
197
|
username: string;
|
|
496
198
|
verified: boolean;
|
|
497
|
-
github_avatar_url: string | null;
|
|
498
199
|
github_name: string | null;
|
|
200
|
+
github_avatar_url: string | null;
|
|
499
201
|
};
|
|
500
202
|
}[] | null;
|
|
501
203
|
}[];
|
|
@@ -506,6 +208,58 @@ interface DownloadOptions {
|
|
|
506
208
|
registry?: string;
|
|
507
209
|
}
|
|
508
210
|
|
|
211
|
+
/**
|
|
212
|
+
* Downloads an extension version from the registry as a stream.
|
|
213
|
+
*
|
|
214
|
+
* This function retrieves the binary content of a specific extension version
|
|
215
|
+
* from the Directus extensions registry. It validates API version compatibility
|
|
216
|
+
* and returns a ReadableStream that can be used to process the downloaded content,
|
|
217
|
+
* such as saving to disk or streaming to a client.
|
|
218
|
+
*
|
|
219
|
+
* @param versionId - The unique identifier of the extension version to download
|
|
220
|
+
* @param requireSandbox - Whether to enable sandbox mode for the download (defaults to false)
|
|
221
|
+
* @param options - Optional configuration for the download request
|
|
222
|
+
* @param options.registry - Custom registry URL to use instead of the default registry
|
|
223
|
+
* @returns Promise that resolves to a ReadableStream containing the extension's binary content
|
|
224
|
+
*
|
|
225
|
+
* @throws {Error} When API version compatibility check fails
|
|
226
|
+
* @throws {Error} When the version ID is not found in the registry
|
|
227
|
+
* @throws {Error} When network request fails or registry is unreachable
|
|
228
|
+
* @throws {Error} When the response status indicates an error (4xx, 5xx)
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* ```typescript
|
|
232
|
+
* // Download extension from default registry
|
|
233
|
+
* const stream = await download('my-extension-v1.0.0');
|
|
234
|
+
*
|
|
235
|
+
* // Save to file system
|
|
236
|
+
* import { createWriteStream } from 'fs';
|
|
237
|
+
* import { pipeline } from 'stream/promises';
|
|
238
|
+
*
|
|
239
|
+
* const fileStream = createWriteStream('./extension.zip');
|
|
240
|
+
* await pipeline(Readable.fromWeb(stream), fileStream);
|
|
241
|
+
*
|
|
242
|
+
* // Download with sandbox mode enabled
|
|
243
|
+
* const sandboxStream = await download('my-extension-v1.0.0', true);
|
|
244
|
+
*
|
|
245
|
+
* // Download from custom registry
|
|
246
|
+
* const customStream = await download('my-extension-v1.0.0', false, {
|
|
247
|
+
* registry: 'https://custom-registry.example.com'
|
|
248
|
+
* });
|
|
249
|
+
*
|
|
250
|
+
* // Download with both sandbox and custom registry
|
|
251
|
+
* const customSandboxStream = await download('my-extension-v1.0.0', true, {
|
|
252
|
+
* registry: 'https://custom-registry.example.com'
|
|
253
|
+
* });
|
|
254
|
+
*
|
|
255
|
+
* // Handle errors
|
|
256
|
+
* try {
|
|
257
|
+
* const stream = await download('non-existent-version');
|
|
258
|
+
* } catch (error) {
|
|
259
|
+
* console.error('Download failed:', error.message);
|
|
260
|
+
* }
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
509
263
|
declare const download: (versionId: string, requireSandbox?: boolean, options?: DownloadOptions) => Promise<stream_web.ReadableStream<any> | null>;
|
|
510
264
|
|
|
511
265
|
interface ListOptions {
|
|
@@ -525,18 +279,25 @@ interface ListQuery {
|
|
|
525
279
|
declare const RegistryListResponse: z.ZodObject<{
|
|
526
280
|
meta: z.ZodObject<{
|
|
527
281
|
filter_count: z.ZodNumber;
|
|
528
|
-
},
|
|
529
|
-
filter_count: number;
|
|
530
|
-
}, {
|
|
531
|
-
filter_count: number;
|
|
532
|
-
}>;
|
|
282
|
+
}, z.core.$strip>;
|
|
533
283
|
data: z.ZodArray<z.ZodObject<{
|
|
534
284
|
id: z.ZodString;
|
|
535
285
|
name: z.ZodString;
|
|
536
|
-
description: z.ZodUnion<[z.ZodNull, z.ZodString]>;
|
|
286
|
+
description: z.ZodUnion<readonly [z.ZodNull, z.ZodString]>;
|
|
537
287
|
total_downloads: z.ZodNumber;
|
|
538
288
|
verified: z.ZodBoolean;
|
|
539
|
-
type: z.ZodEnum<
|
|
289
|
+
type: z.ZodEnum<{
|
|
290
|
+
interface: "interface";
|
|
291
|
+
display: "display";
|
|
292
|
+
layout: "layout";
|
|
293
|
+
module: "module";
|
|
294
|
+
panel: "panel";
|
|
295
|
+
theme: "theme";
|
|
296
|
+
hook: "hook";
|
|
297
|
+
endpoint: "endpoint";
|
|
298
|
+
operation: "operation";
|
|
299
|
+
bundle: "bundle";
|
|
300
|
+
}>;
|
|
540
301
|
last_updated: z.ZodString;
|
|
541
302
|
host_version: z.ZodString;
|
|
542
303
|
sandbox: z.ZodBoolean;
|
|
@@ -545,114 +306,32 @@ declare const RegistryListResponse: z.ZodObject<{
|
|
|
545
306
|
username: z.ZodString;
|
|
546
307
|
verified: z.ZodBoolean;
|
|
547
308
|
github_name: z.ZodNullable<z.ZodString>;
|
|
548
|
-
},
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
verified: boolean;
|
|
555
|
-
github_name: string | null;
|
|
556
|
-
}>;
|
|
557
|
-
}, "strip", z.ZodTypeAny, {
|
|
558
|
-
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
559
|
-
id: string;
|
|
560
|
-
verified: boolean;
|
|
561
|
-
name: string;
|
|
562
|
-
description: string | null;
|
|
563
|
-
total_downloads: number;
|
|
564
|
-
license: string | null;
|
|
565
|
-
host_version: string;
|
|
566
|
-
publisher: {
|
|
567
|
-
username: string;
|
|
568
|
-
verified: boolean;
|
|
569
|
-
github_name: string | null;
|
|
570
|
-
};
|
|
571
|
-
sandbox: boolean;
|
|
572
|
-
last_updated: string;
|
|
573
|
-
}, {
|
|
574
|
-
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
575
|
-
id: string;
|
|
576
|
-
verified: boolean;
|
|
577
|
-
name: string;
|
|
578
|
-
description: string | null;
|
|
579
|
-
total_downloads: number;
|
|
580
|
-
license: string | null;
|
|
581
|
-
host_version: string;
|
|
582
|
-
publisher: {
|
|
583
|
-
username: string;
|
|
584
|
-
verified: boolean;
|
|
585
|
-
github_name: string | null;
|
|
586
|
-
};
|
|
587
|
-
sandbox: boolean;
|
|
588
|
-
last_updated: string;
|
|
589
|
-
}>, "many">;
|
|
590
|
-
}, "strip", z.ZodTypeAny, {
|
|
591
|
-
data: {
|
|
592
|
-
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
593
|
-
id: string;
|
|
594
|
-
verified: boolean;
|
|
595
|
-
name: string;
|
|
596
|
-
description: string | null;
|
|
597
|
-
total_downloads: number;
|
|
598
|
-
license: string | null;
|
|
599
|
-
host_version: string;
|
|
600
|
-
publisher: {
|
|
601
|
-
username: string;
|
|
602
|
-
verified: boolean;
|
|
603
|
-
github_name: string | null;
|
|
604
|
-
};
|
|
605
|
-
sandbox: boolean;
|
|
606
|
-
last_updated: string;
|
|
607
|
-
}[];
|
|
309
|
+
}, z.core.$strip>;
|
|
310
|
+
}, z.core.$strip>>;
|
|
311
|
+
}, z.core.$strip>;
|
|
312
|
+
type RegistryListResponse = z.infer<typeof RegistryListResponse>;
|
|
313
|
+
|
|
314
|
+
declare const list: (query: ListQuery, options?: ListOptions) => Promise<{
|
|
608
315
|
meta: {
|
|
609
316
|
filter_count: number;
|
|
610
317
|
};
|
|
611
|
-
}, {
|
|
612
318
|
data: {
|
|
613
|
-
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
614
319
|
id: string;
|
|
615
|
-
verified: boolean;
|
|
616
320
|
name: string;
|
|
617
321
|
description: string | null;
|
|
618
322
|
total_downloads: number;
|
|
619
|
-
|
|
323
|
+
verified: boolean;
|
|
324
|
+
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
325
|
+
last_updated: string;
|
|
620
326
|
host_version: string;
|
|
621
|
-
publisher: {
|
|
622
|
-
username: string;
|
|
623
|
-
verified: boolean;
|
|
624
|
-
github_name: string | null;
|
|
625
|
-
};
|
|
626
327
|
sandbox: boolean;
|
|
627
|
-
last_updated: string;
|
|
628
|
-
}[];
|
|
629
|
-
meta: {
|
|
630
|
-
filter_count: number;
|
|
631
|
-
};
|
|
632
|
-
}>;
|
|
633
|
-
type RegistryListResponse = z.infer<typeof RegistryListResponse>;
|
|
634
|
-
|
|
635
|
-
declare const list: (query: ListQuery, options?: ListOptions) => Promise<{
|
|
636
|
-
data: {
|
|
637
|
-
type: "interface" | "display" | "layout" | "module" | "panel" | "theme" | "hook" | "endpoint" | "operation" | "bundle";
|
|
638
|
-
id: string;
|
|
639
|
-
verified: boolean;
|
|
640
|
-
name: string;
|
|
641
|
-
description: string | null;
|
|
642
|
-
total_downloads: number;
|
|
643
328
|
license: string | null;
|
|
644
|
-
host_version: string;
|
|
645
329
|
publisher: {
|
|
646
330
|
username: string;
|
|
647
331
|
verified: boolean;
|
|
648
332
|
github_name: string | null;
|
|
649
333
|
};
|
|
650
|
-
sandbox: boolean;
|
|
651
|
-
last_updated: string;
|
|
652
334
|
}[];
|
|
653
|
-
meta: {
|
|
654
|
-
filter_count: number;
|
|
655
|
-
};
|
|
656
335
|
}>;
|
|
657
336
|
|
|
658
337
|
export { type AccountOptions, type DescribeOptions, type DownloadOptions, type ListOptions, type ListQuery, RegistryAccountResponse, RegistryDescribeResponse, RegistryListResponse, account, describe, download, list };
|
package/dist/index.js
CHANGED
|
@@ -82,7 +82,7 @@ var constructUrl2 = (id, options) => {
|
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
// src/modules/describe/schemas/registry-describe-response.ts
|
|
85
|
-
import { EXTENSION_TYPES } from "@directus/
|
|
85
|
+
import { EXTENSION_TYPES } from "@directus/constants";
|
|
86
86
|
import { z as z3 } from "zod";
|
|
87
87
|
var RegistryDescribeResponse = z3.object({
|
|
88
88
|
data: z3.object({
|
|
@@ -207,7 +207,7 @@ var constructUrl4 = (query, options) => {
|
|
|
207
207
|
};
|
|
208
208
|
|
|
209
209
|
// src/modules/list/schemas/registry-list-response.ts
|
|
210
|
-
import { EXTENSION_TYPES as EXTENSION_TYPES2 } from "@directus/
|
|
210
|
+
import { EXTENSION_TYPES as EXTENSION_TYPES2 } from "@directus/constants";
|
|
211
211
|
import { z as z4 } from "zod";
|
|
212
212
|
var RegistryListResponse = z4.object({
|
|
213
213
|
meta: z4.object({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@directus/extensions-registry",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.10",
|
|
4
4
|
"description": "Abstraction for exploring Directus extensions on a package registry",
|
|
5
5
|
"homepage": "https://directus.io",
|
|
6
6
|
"repository": {
|
|
@@ -21,17 +21,19 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"ky": "1.
|
|
25
|
-
"zod": "
|
|
26
|
-
"@directus/
|
|
27
|
-
"@directus/
|
|
24
|
+
"ky": "1.8.2",
|
|
25
|
+
"zod": "4.0.14",
|
|
26
|
+
"@directus/constants": "13.0.2",
|
|
27
|
+
"@directus/errors": "2.0.3",
|
|
28
|
+
"@directus/extensions": "3.0.10"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@directus/tsconfig": "3.0.0",
|
|
31
32
|
"@vitest/coverage-v8": "3.2.4",
|
|
32
33
|
"tsup": "8.5.0",
|
|
33
34
|
"typescript": "5.8.3",
|
|
34
|
-
"vitest": "3.2.4"
|
|
35
|
+
"vitest": "3.2.4",
|
|
36
|
+
"@directus/types": "13.2.2"
|
|
35
37
|
},
|
|
36
38
|
"scripts": {
|
|
37
39
|
"build": "tsup src/index.ts --format=esm --dts",
|