-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample_registry_addon.ts
75 lines (65 loc) · 1.91 KB
/
example_registry_addon.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { colors } from "../deps.ts";
import { Registry } from "../registries/registry.ts";
export class TestRegistry extends Registry {
static key = 'test';
getWellKnownPath() {
return "random";
}
getRegistryInfo() {
return {
key: TestRegistry.key,
name: colors.magenta('TEST/x'),
icon: '🐛',
url: 'https://test.land',
description: '`TEST ADDON REGISTRY`'
}
}
async getAllModuleNames() {
return ['test1', 'test2'];
}
async getVersionsOfModule(moduleName: string) {
return ['1', '2', '3']
}
async getModulesList(query?: string, page: number=1, pageSize: number = 20) {
return {
modules: [
{
name: 'testmodule',
description: 'nincs',
starCount: 5,
owner: 'me',
}
],
page: 1,
pageSize: 1,
totalModules: 1,
totalPages: 1,
}
}
async getModuleInfo(moduleName: string, version?: string) {
return {
origin: "TEST" as any,
info: {
name: 'testt',
description: 'testt',
start_count: 5,
versions: ['testt'],
latestVersion: 'testt',
repository: 'testt',
moduleRoute: 'testt',
// importRoute: 'testt',
},
invalidVersion: false,
currentVersion: 'testt',
uploadedAt: new Date(),
readmePath: 'testt',
readmeText: 'testt',
}
}
private getRepositoryPath(upload_options?: {type: string, repository: string, ref: string}, version?: string): string | undefined {
return 'semmi';
}
}
export function getAddonRegistry() {
return new TestRegistry();
}