-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
common.ts
67 lines (56 loc) · 1.43 KB
/
common.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
import { DATASOURCE_FAILURE } from '../constants/error-messages';
export interface Config {
datasource?: string;
depName?: string;
lookupName?: string;
registryUrls?: string[];
}
export interface PkgReleaseConfig extends Config {
compatibility?: Record<string, string>;
depType?: string;
lookupType?: string;
npmrc?: string;
versionScheme?: string;
}
export type DigestConfig = Config;
export interface Release {
changelogUrl?: string;
gitRef?: string;
isDeprecated?: boolean;
releaseTimestamp?: any;
version: string;
}
export interface ReleaseResult {
sourceDirectory?: string;
latestVersion?: string;
changelogUrl?: string;
dependencyUrl?: string;
deprecationMessage?: string;
display?: string;
dockerRegistry?: string;
dockerRepository?: string;
group?: string;
homepage?: string;
name?: string;
pkgName?: string;
releases: Release[];
sourceUrl?: string;
tags?: string[];
versions?: any;
}
// TODO: Proper typing
export type Preset = any;
export interface Datasource {
getDigest?(config: DigestConfig, newValue?: string): Promise<string | null>;
getPreset?(packageName: string, presetName?: string): Promise<Preset>;
getPkgReleases(config: PkgReleaseConfig): Promise<ReleaseResult | null>;
}
export class DatasourceError extends Error {
err: Error;
datasource?: string;
lookupName?: string;
constructor(err: Error) {
super(DATASOURCE_FAILURE);
this.err = err;
}
}