glost-registry 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +283 -0
- package/dist/discovery.d.ts +146 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +262 -0
- package/dist/discovery.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/registry.d.ts +193 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +466 -0
- package/dist/registry.js.map +1 -0
- package/dist/types.d.ts +208 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/validation.d.ts +53 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +204 -0
- package/dist/validation.js.map +1 -0
- package/package.json +45 -0
- package/src/discovery.ts +315 -0
- package/src/index.ts +50 -0
- package/src/registry.ts +557 -0
- package/src/types.ts +275 -0
- package/src/validation.ts +240 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Discovery
|
|
3
|
+
*
|
|
4
|
+
* Utilities for discovering and filtering plugins.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Filter plugins by various criteria
|
|
10
|
+
*/
|
|
11
|
+
export class PluginFilter {
|
|
12
|
+
/**
|
|
13
|
+
* Filter plugins by keyword
|
|
14
|
+
*
|
|
15
|
+
* @param plugins - Plugins to filter
|
|
16
|
+
* @param keyword - Keyword to search for
|
|
17
|
+
* @returns Filtered plugins
|
|
18
|
+
*/
|
|
19
|
+
static byKeyword(plugins, keyword) {
|
|
20
|
+
const lowerKeyword = keyword.toLowerCase();
|
|
21
|
+
return plugins.filter((plugin) => {
|
|
22
|
+
return (plugin.name.toLowerCase().includes(lowerKeyword) ||
|
|
23
|
+
plugin.description.toLowerCase().includes(lowerKeyword) ||
|
|
24
|
+
plugin.id.toLowerCase().includes(lowerKeyword) ||
|
|
25
|
+
plugin.tags.some((tag) => tag.toLowerCase().includes(lowerKeyword)));
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Filter plugins by category
|
|
30
|
+
*
|
|
31
|
+
* @param plugins - Plugins to filter
|
|
32
|
+
* @param category - Category to filter by
|
|
33
|
+
* @returns Filtered plugins
|
|
34
|
+
*/
|
|
35
|
+
static byCategory(plugins, category) {
|
|
36
|
+
return plugins.filter((plugin) => plugin.category === category);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Filter plugins by language support
|
|
40
|
+
*
|
|
41
|
+
* @param plugins - Plugins to filter
|
|
42
|
+
* @param language - Language code
|
|
43
|
+
* @returns Filtered plugins
|
|
44
|
+
*/
|
|
45
|
+
static byLanguage(plugins, language) {
|
|
46
|
+
return plugins.filter((plugin) => {
|
|
47
|
+
return (!plugin.supports.languages ||
|
|
48
|
+
plugin.supports.languages.includes(language));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Filter plugins by tags
|
|
53
|
+
*
|
|
54
|
+
* @param plugins - Plugins to filter
|
|
55
|
+
* @param tags - Tags to match (any)
|
|
56
|
+
* @returns Filtered plugins
|
|
57
|
+
*/
|
|
58
|
+
static byTags(plugins, tags) {
|
|
59
|
+
return plugins.filter((plugin) => {
|
|
60
|
+
return tags.some((tag) => plugin.tags.includes(tag));
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Filter plugins by author
|
|
65
|
+
*
|
|
66
|
+
* @param plugins - Plugins to filter
|
|
67
|
+
* @param author - Author name
|
|
68
|
+
* @returns Filtered plugins
|
|
69
|
+
*/
|
|
70
|
+
static byAuthor(plugins, author) {
|
|
71
|
+
return plugins.filter((plugin) => plugin.author === author);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Filter plugins that support async
|
|
75
|
+
*
|
|
76
|
+
* @param plugins - Plugins to filter
|
|
77
|
+
* @returns Filtered plugins
|
|
78
|
+
*/
|
|
79
|
+
static asyncOnly(plugins) {
|
|
80
|
+
return plugins.filter((plugin) => plugin.supports.async);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Filter plugins that support parallel execution
|
|
84
|
+
*
|
|
85
|
+
* @param plugins - Plugins to filter
|
|
86
|
+
* @returns Filtered plugins
|
|
87
|
+
*/
|
|
88
|
+
static parallelOnly(plugins) {
|
|
89
|
+
return plugins.filter((plugin) => plugin.supports.parallel);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Apply multiple filters
|
|
93
|
+
*
|
|
94
|
+
* @param plugins - Plugins to filter
|
|
95
|
+
* @param query - Filter query
|
|
96
|
+
* @returns Filtered plugins
|
|
97
|
+
*/
|
|
98
|
+
static apply(plugins, query) {
|
|
99
|
+
let result = plugins;
|
|
100
|
+
if (query.keyword) {
|
|
101
|
+
result = this.byKeyword(result, query.keyword);
|
|
102
|
+
}
|
|
103
|
+
if (query.category) {
|
|
104
|
+
result = this.byCategory(result, query.category);
|
|
105
|
+
}
|
|
106
|
+
if (query.language) {
|
|
107
|
+
result = this.byLanguage(result, query.language);
|
|
108
|
+
}
|
|
109
|
+
if (query.tags && query.tags.length > 0) {
|
|
110
|
+
result = this.byTags(result, query.tags);
|
|
111
|
+
}
|
|
112
|
+
if (query.author) {
|
|
113
|
+
result = this.byAuthor(result, query.author);
|
|
114
|
+
}
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Sort plugins by various criteria
|
|
120
|
+
*/
|
|
121
|
+
export class PluginSorter {
|
|
122
|
+
/**
|
|
123
|
+
* Sort plugins by name
|
|
124
|
+
*
|
|
125
|
+
* @param plugins - Plugins to sort
|
|
126
|
+
* @param ascending - Sort order
|
|
127
|
+
* @returns Sorted plugins
|
|
128
|
+
*/
|
|
129
|
+
static byName(plugins, ascending = true) {
|
|
130
|
+
return [...plugins].sort((a, b) => {
|
|
131
|
+
const result = a.name.localeCompare(b.name);
|
|
132
|
+
return ascending ? result : -result;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Sort plugins by registration date
|
|
137
|
+
*
|
|
138
|
+
* @param plugins - Plugins to sort
|
|
139
|
+
* @param ascending - Sort order
|
|
140
|
+
* @returns Sorted plugins
|
|
141
|
+
*/
|
|
142
|
+
static byDate(plugins, ascending = true) {
|
|
143
|
+
return [...plugins].sort((a, b) => {
|
|
144
|
+
const dateA = a.registeredAt?.getTime() || 0;
|
|
145
|
+
const dateB = b.registeredAt?.getTime() || 0;
|
|
146
|
+
const result = dateA - dateB;
|
|
147
|
+
return ascending ? result : -result;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Sort plugins by category
|
|
152
|
+
*
|
|
153
|
+
* @param plugins - Plugins to sort
|
|
154
|
+
* @returns Sorted plugins
|
|
155
|
+
*/
|
|
156
|
+
static byCategory(plugins) {
|
|
157
|
+
const order = [
|
|
158
|
+
"generator",
|
|
159
|
+
"transformer",
|
|
160
|
+
"enhancer",
|
|
161
|
+
"analyzer",
|
|
162
|
+
"utility",
|
|
163
|
+
];
|
|
164
|
+
return [...plugins].sort((a, b) => {
|
|
165
|
+
return order.indexOf(a.category) - order.indexOf(b.category);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Plugin discovery helpers
|
|
171
|
+
*/
|
|
172
|
+
export class PluginDiscovery {
|
|
173
|
+
/**
|
|
174
|
+
* Find plugins related to a given plugin
|
|
175
|
+
*
|
|
176
|
+
* @param plugins - All plugins
|
|
177
|
+
* @param pluginId - Plugin to find related plugins for
|
|
178
|
+
* @returns Related plugins
|
|
179
|
+
*/
|
|
180
|
+
static findRelated(plugins, pluginId) {
|
|
181
|
+
const plugin = plugins.find((p) => p.id === pluginId);
|
|
182
|
+
if (!plugin) {
|
|
183
|
+
return [];
|
|
184
|
+
}
|
|
185
|
+
// Find plugins with similar tags
|
|
186
|
+
return plugins.filter((p) => {
|
|
187
|
+
if (p.id === pluginId) {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
const sharedTags = plugin.tags.filter((tag) => p.tags.includes(tag));
|
|
191
|
+
return sharedTags.length > 0;
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Find plugins that depend on a given plugin
|
|
196
|
+
*
|
|
197
|
+
* @param plugins - All plugins
|
|
198
|
+
* @param allExtensions - Map of extensions (for dependency info)
|
|
199
|
+
* @param pluginId - Plugin to find dependents for
|
|
200
|
+
* @returns Dependent plugins
|
|
201
|
+
*/
|
|
202
|
+
static findDependents(plugins, allExtensions, pluginId) {
|
|
203
|
+
return plugins.filter((p) => {
|
|
204
|
+
const ext = allExtensions.get(p.id);
|
|
205
|
+
return ext?.dependencies?.includes(pluginId);
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Find missing dependencies for plugins
|
|
210
|
+
*
|
|
211
|
+
* @param plugins - Plugins to check
|
|
212
|
+
* @param allExtensions - Map of all extensions
|
|
213
|
+
* @returns Map of plugin ID to missing dependencies
|
|
214
|
+
*/
|
|
215
|
+
static findMissingDependencies(plugins, allExtensions) {
|
|
216
|
+
const missing = new Map();
|
|
217
|
+
const availableIds = new Set(plugins.map((p) => p.id));
|
|
218
|
+
for (const plugin of plugins) {
|
|
219
|
+
const ext = allExtensions.get(plugin.id);
|
|
220
|
+
if (ext?.dependencies) {
|
|
221
|
+
const missingDeps = ext.dependencies.filter((dep) => !availableIds.has(dep));
|
|
222
|
+
if (missingDeps.length > 0) {
|
|
223
|
+
missing.set(plugin.id, missingDeps);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return missing;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Suggest plugins based on a user's current plugins
|
|
231
|
+
*
|
|
232
|
+
* @param currentPlugins - Currently used plugins
|
|
233
|
+
* @param allPlugins - All available plugins
|
|
234
|
+
* @returns Suggested plugins
|
|
235
|
+
*/
|
|
236
|
+
static suggestPlugins(currentPlugins, allPlugins) {
|
|
237
|
+
if (currentPlugins.length === 0) {
|
|
238
|
+
return [];
|
|
239
|
+
}
|
|
240
|
+
// Collect all tags from current plugins
|
|
241
|
+
const currentTags = new Set();
|
|
242
|
+
for (const plugin of currentPlugins) {
|
|
243
|
+
plugin.tags.forEach((tag) => currentTags.add(tag));
|
|
244
|
+
}
|
|
245
|
+
// Find plugins with similar tags that aren't already used
|
|
246
|
+
const currentIds = new Set(currentPlugins.map((p) => p.id));
|
|
247
|
+
const suggestions = allPlugins.filter((plugin) => {
|
|
248
|
+
if (currentIds.has(plugin.id)) {
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
const matchingTags = plugin.tags.filter((tag) => currentTags.has(tag));
|
|
252
|
+
return matchingTags.length > 0;
|
|
253
|
+
});
|
|
254
|
+
// Sort by number of matching tags
|
|
255
|
+
return suggestions.sort((a, b) => {
|
|
256
|
+
const aMatches = a.tags.filter((tag) => currentTags.has(tag)).length;
|
|
257
|
+
const bMatches = b.tags.filter((tag) => currentTags.has(tag)).length;
|
|
258
|
+
return bMatches - aMatches;
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,MAAM,OAAO,YAAY;IACvB;;;;;;OAMG;IACH,MAAM,CAAC,SAAS,CAAC,OAAyB,EAAE,OAAe;QACzD,MAAM,YAAY,GAAG,OAAO,CAAC,WAA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
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { pluginRegistry } from "glost-registry";
|
|
11
|
+
*
|
|
12
|
+
* // Register a plugin
|
|
13
|
+
* pluginRegistry.register(myExtension, {
|
|
14
|
+
* version: "1.0.0",
|
|
15
|
+
* description: "My awesome plugin",
|
|
16
|
+
* category: "enhancer",
|
|
17
|
+
* tags: ["transcription"],
|
|
18
|
+
* supports: {
|
|
19
|
+
* languages: ["th", "ja"],
|
|
20
|
+
* async: true
|
|
21
|
+
* }
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* // Search for plugins
|
|
25
|
+
* const plugins = pluginRegistry.search({ language: "th" });
|
|
26
|
+
*
|
|
27
|
+
* // Check for conflicts
|
|
28
|
+
* const report = pluginRegistry.checkConflicts(["plugin1", "plugin2"]);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export { PluginRegistry, pluginRegistry } from "./registry.js";
|
|
32
|
+
export { PluginFilter, PluginSorter, PluginDiscovery } from "./discovery.js";
|
|
33
|
+
export { PluginValidator } from "./validation.js";
|
|
34
|
+
export type { PluginMetadata, PluginCategory, PluginCapabilities, PluginRequirements, PluginOptionsSchema, PropertySchema, PluginExample, PluginQuery, ConflictReport, PluginConflict, ValidationResult, ValidationError, ValidationWarning, RegistryStatistics, } from "./types.js";
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EACV,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,WAAW,EACX,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GLOST Plugin Registry
|
|
3
|
+
*
|
|
4
|
+
* Enhanced plugin registry with discovery, metadata, and validation.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { pluginRegistry } from "glost-registry";
|
|
11
|
+
*
|
|
12
|
+
* // Register a plugin
|
|
13
|
+
* pluginRegistry.register(myExtension, {
|
|
14
|
+
* version: "1.0.0",
|
|
15
|
+
* description: "My awesome plugin",
|
|
16
|
+
* category: "enhancer",
|
|
17
|
+
* tags: ["transcription"],
|
|
18
|
+
* supports: {
|
|
19
|
+
* languages: ["th", "ja"],
|
|
20
|
+
* async: true
|
|
21
|
+
* }
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* // Search for plugins
|
|
25
|
+
* const plugins = pluginRegistry.search({ language: "th" });
|
|
26
|
+
*
|
|
27
|
+
* // Check for conflicts
|
|
28
|
+
* const report = pluginRegistry.checkConflicts(["plugin1", "plugin2"]);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export { PluginRegistry, pluginRegistry } from "./registry.js";
|
|
32
|
+
export { PluginFilter, PluginSorter, PluginDiscovery } from "./discovery.js";
|
|
33
|
+
export { PluginValidator } from "./validation.js";
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced Plugin Registry
|
|
3
|
+
*
|
|
4
|
+
* Plugin registry with discovery, metadata, and validation capabilities.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
import type { GLOSTExtension } from "glost-extensions";
|
|
9
|
+
import type { PluginMetadata, PluginQuery, PluginCategory, ConflictReport, ValidationResult, RegistryStatistics } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Enhanced Plugin Registry
|
|
12
|
+
*
|
|
13
|
+
* Manages plugin metadata, discovery, validation, and conflict detection.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { PluginRegistry } from "glost-registry";
|
|
18
|
+
*
|
|
19
|
+
* const registry = new PluginRegistry();
|
|
20
|
+
*
|
|
21
|
+
* registry.register(myPlugin, {
|
|
22
|
+
* version: "1.0.0",
|
|
23
|
+
* category: "enhancer",
|
|
24
|
+
* tags: ["transcription", "ipa"]
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* const plugins = registry.search({ language: "th" });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare class PluginRegistry {
|
|
31
|
+
private plugins;
|
|
32
|
+
private extensions;
|
|
33
|
+
/**
|
|
34
|
+
* Register a plugin with metadata
|
|
35
|
+
*
|
|
36
|
+
* @param extension - The plugin extension
|
|
37
|
+
* @param metadata - Plugin metadata
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* registry.register(myExtension, {
|
|
42
|
+
* version: "1.0.0",
|
|
43
|
+
* description: "Adds transcription support",
|
|
44
|
+
* category: "enhancer",
|
|
45
|
+
* tags: ["transcription"],
|
|
46
|
+
* supports: {
|
|
47
|
+
* languages: ["th", "ja"],
|
|
48
|
+
* async: true
|
|
49
|
+
* }
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
register(extension: GLOSTExtension, metadata: Omit<PluginMetadata, "id" | "name">): void;
|
|
54
|
+
/**
|
|
55
|
+
* Get plugin metadata
|
|
56
|
+
*
|
|
57
|
+
* @param pluginId - Plugin ID
|
|
58
|
+
* @returns Plugin metadata or undefined
|
|
59
|
+
*/
|
|
60
|
+
getMetadata(pluginId: string): PluginMetadata | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Get plugin extension
|
|
63
|
+
*
|
|
64
|
+
* @param pluginId - Plugin ID
|
|
65
|
+
* @returns Plugin extension or undefined
|
|
66
|
+
*/
|
|
67
|
+
getExtension(pluginId: string): GLOSTExtension | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* List all plugins
|
|
70
|
+
*
|
|
71
|
+
* @returns Array of all plugin metadata
|
|
72
|
+
*/
|
|
73
|
+
list(): PluginMetadata[];
|
|
74
|
+
/**
|
|
75
|
+
* Search for plugins
|
|
76
|
+
*
|
|
77
|
+
* @param query - Search query
|
|
78
|
+
* @returns Array of matching plugin metadata
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* // Search by keyword
|
|
83
|
+
* const results = registry.search({ keyword: "transcription" });
|
|
84
|
+
*
|
|
85
|
+
* // Filter by category
|
|
86
|
+
* const enhancers = registry.search({ category: "enhancer" });
|
|
87
|
+
*
|
|
88
|
+
* // Filter by language
|
|
89
|
+
* const thaiPlugins = registry.search({ language: "th" });
|
|
90
|
+
*
|
|
91
|
+
* // Multiple filters
|
|
92
|
+
* const results = registry.search({
|
|
93
|
+
* category: "enhancer",
|
|
94
|
+
* language: "th",
|
|
95
|
+
* tags: ["transcription"]
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
search(query: PluginQuery): PluginMetadata[];
|
|
100
|
+
/**
|
|
101
|
+
* Get plugins by category
|
|
102
|
+
*
|
|
103
|
+
* @param category - Plugin category
|
|
104
|
+
* @returns Array of plugin metadata
|
|
105
|
+
*/
|
|
106
|
+
getByCategory(category: PluginCategory): PluginMetadata[];
|
|
107
|
+
/**
|
|
108
|
+
* Get plugins that support a language
|
|
109
|
+
*
|
|
110
|
+
* @param language - Language code
|
|
111
|
+
* @returns Array of plugin metadata
|
|
112
|
+
*/
|
|
113
|
+
getLanguageSupport(language: string): PluginMetadata[];
|
|
114
|
+
/**
|
|
115
|
+
* Check if a plugin supports a language
|
|
116
|
+
*
|
|
117
|
+
* @param pluginId - Plugin ID
|
|
118
|
+
* @param language - Language code
|
|
119
|
+
* @returns True if supported
|
|
120
|
+
*/
|
|
121
|
+
isLanguageSupported(pluginId: string, language: string): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Check plugin compatibility
|
|
124
|
+
*
|
|
125
|
+
* @param pluginId - Plugin ID
|
|
126
|
+
* @param version - Version to check (semver)
|
|
127
|
+
* @returns True if compatible
|
|
128
|
+
*/
|
|
129
|
+
isCompatible(pluginId: string, version: string): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Check for conflicts between plugins
|
|
132
|
+
*
|
|
133
|
+
* @param pluginIds - Plugin IDs to check
|
|
134
|
+
* @returns Conflict report
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* const report = registry.checkConflicts(["plugin1", "plugin2", "plugin3"]);
|
|
139
|
+
* if (report.hasConflicts) {
|
|
140
|
+
* for (const conflict of report.conflicts) {
|
|
141
|
+
* console.error(`Conflict: ${conflict.plugin1} <-> ${conflict.plugin2}`);
|
|
142
|
+
* console.error(`Reason: ${conflict.reason}`);
|
|
143
|
+
* }
|
|
144
|
+
* }
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
checkConflicts(pluginIds: string[]): ConflictReport;
|
|
148
|
+
/**
|
|
149
|
+
* Resolve dependencies for plugins
|
|
150
|
+
*
|
|
151
|
+
* @param pluginIds - Plugin IDs to resolve
|
|
152
|
+
* @returns Array of plugin IDs in dependency order
|
|
153
|
+
* @throws {Error} If circular dependencies detected or plugin not found
|
|
154
|
+
*/
|
|
155
|
+
resolveDependencies(pluginIds: string[]): string[];
|
|
156
|
+
/**
|
|
157
|
+
* Validate a plugin configuration
|
|
158
|
+
*
|
|
159
|
+
* @param pluginId - Plugin ID
|
|
160
|
+
* @param options - Plugin options to validate
|
|
161
|
+
* @returns Validation result
|
|
162
|
+
*/
|
|
163
|
+
validate(pluginId: string, options?: any): ValidationResult;
|
|
164
|
+
/**
|
|
165
|
+
* Get registry statistics
|
|
166
|
+
*
|
|
167
|
+
* @returns Registry statistics
|
|
168
|
+
*/
|
|
169
|
+
getStatistics(): RegistryStatistics;
|
|
170
|
+
/**
|
|
171
|
+
* Check if a plugin is registered
|
|
172
|
+
*
|
|
173
|
+
* @param pluginId - Plugin ID
|
|
174
|
+
* @returns True if registered
|
|
175
|
+
*/
|
|
176
|
+
has(pluginId: string): boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Unregister a plugin
|
|
179
|
+
*
|
|
180
|
+
* @param pluginId - Plugin ID
|
|
181
|
+
* @returns True if unregistered
|
|
182
|
+
*/
|
|
183
|
+
unregister(pluginId: string): boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Clear all plugins
|
|
186
|
+
*/
|
|
187
|
+
clear(): void;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Global plugin registry instance
|
|
191
|
+
*/
|
|
192
|
+
export declare const pluginRegistry: PluginRegistry;
|
|
193
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],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