-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
types.ts
140 lines (128 loc) · 3.88 KB
/
types.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import type {
ConstraintsFilter,
CustomDatasourceConfig,
} from '../../config/types';
import type { ModuleApi } from '../../types';
export interface GetDigestInputConfig {
datasource: string;
packageName: string;
defaultRegistryUrls?: string[];
registryUrls?: string[] | null;
registryUrl?: string;
lookupName?: string;
additionalRegistryUrls?: string[];
currentValue?: string;
currentDigest?: string;
replacementName?: string;
}
export interface DigestConfig {
packageName: string;
lookupName?: string;
registryUrl?: string;
currentValue?: string;
currentDigest?: string;
}
export interface GetReleasesConfig {
customDatasources?: Record<string, CustomDatasourceConfig>;
datasource?: string;
packageName: string;
registryUrl?: string;
currentValue?: string;
}
export interface GetPkgReleasesConfig {
customDatasources?: Record<string, CustomDatasourceConfig>;
npmrc?: string;
defaultRegistryUrls?: string[];
registryUrls?: string[] | null;
additionalRegistryUrls?: string[];
datasource: string;
packageName: string;
currentValue?: string;
versioning?: string;
extractVersion?: string;
versionCompatibility?: string;
currentCompatibility?: string;
constraints?: Record<string, string>;
replacementName?: string;
replacementVersion?: string;
constraintsFiltering?: ConstraintsFilter;
}
export interface Release {
changelogUrl?: string;
checksumUrl?: string;
downloadUrl?: string;
gitRef?: string;
isDeprecated?: boolean;
isStable?: boolean;
releaseTimestamp?: string | null;
version: string;
newDigest?: string | undefined;
constraints?: Record<string, string[]>;
dependencies?: Record<string, string>;
devDependencies?: Record<string, string>;
registryUrl?: string;
sourceUrl?: string | undefined;
sourceDirectory?: string;
currentAge?: string;
}
export interface ReleaseResult {
deprecationMessage?: string;
isPrivate?: boolean;
releases: Release[];
tags?: Record<string, string> | undefined;
// URL metadata
changelogUrl?: string;
dependencyUrl?: string;
homepage?: string | undefined;
gitRef?: string;
sourceUrl?: string | null;
sourceDirectory?: string;
registryUrl?: string;
replacementName?: string;
replacementVersion?: string;
lookupName?: string;
packageScope?: string;
}
export type RegistryStrategy = 'first' | 'hunt' | 'merge';
export type SourceUrlSupport = 'package' | 'release' | 'none';
export interface DatasourceApi extends ModuleApi {
id: string;
getDigest?(config: DigestConfig, newValue?: string): Promise<string | null>;
getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null>;
defaultRegistryUrls?: string[] | (() => string[]);
defaultVersioning?: string | undefined;
defaultConfig?: Record<string, unknown> | undefined;
/**
* Strategy to use when multiple registryUrls are available to the datasource.
* first: only the first registryUrl will be tried and others ignored
* hunt: registryUrls will be tried in order until one returns a result
* merge: all registryUrls will be tried and the results merged if more than one returns a result
*/
registryStrategy?: RegistryStrategy | undefined;
/**
* Whether custom registryUrls are allowed.
*/
customRegistrySupport: boolean;
/**
* Whether release timestamp can be returned.
*/
releaseTimestampSupport: boolean;
/**
* Notes on how release timestamp is determined.
*/
releaseTimestampNote?: string;
/**
* Whether sourceURL can be returned.
*/
sourceUrlSupport: SourceUrlSupport;
/**
* Notes on how sourceURL is determined.
*/
sourceUrlNote?: string;
/**
* Whether to perform caching in the datasource index/wrapper or not.
* true: datasoure index wrapper should cache all results (based on registryUrl/packageName)
* false: caching is not performed, or performed within the datasource implementation
*/
caching?: boolean | undefined;
}