-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtypes.d.ts
276 lines (246 loc) · 7.07 KB
/
types.d.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
/** Types that are shared across apiland.
*
* @module
*/
import type { patterns } from "./consts.ts";
export interface ApiModuleData {
name: string;
type: string;
repo_id: number;
owner: string;
repo: string;
description: string;
is_unlisted: boolean;
created_at: Date;
}
export interface OwnerQuota {
owner: string;
type: string;
max_modules: number;
max_total_size?: number;
blocked: boolean;
note?: string;
}
export interface ModuleMetaVersionsJson {
latest: string;
versions: string[];
}
export interface UploadOptions {
type: string;
repository: string;
ref: string;
subdir?: string;
}
export type BuildStatus =
| "queued"
| "success"
| "error"
| "publishing";
export interface Build {
id: string;
module: string;
version: string;
status: BuildStatus;
message?: string;
created_at: Date;
upload_options: UploadOptions;
}
export interface ModuleVersionMetaJson {
uploaded_at: string;
upload_options: UploadOptions;
directory_listing: {
path: string;
size: number;
type: "file" | "dir";
default?: string;
docable?: boolean;
dirs?: string[];
index?: string[];
}[];
}
export interface PackageMetaListing {
path: string;
size: number;
type: "file" | "dir";
}
/**
* Common types used for data structures within the project
*
* @module
*/
/** Stored as kind `module` in the datastore. */
export interface Module {
name: string;
description: string;
versions: string[];
latest_version: string | null;
maintenance_score?: number;
/** A weighted score of how popular a module is. */
popularity_score?: number;
quality_score?: number;
/** Tags which are associated with the module. */
tags?: ModuleTag[];
upload_options?: UploadOptions;
}
/** Defines a tag related to how popular a module is. */
export interface PopularityModuleTag {
kind: "popularity";
value: "top_1_percent" | "top_5_percent" | "top_10_percent";
}
/** Defines a "tag" which can be displayed when rending a module or part of a
* module. */
export type ModuleTag = PopularityModuleTag;
export interface DependencyModuleMetrics {
/** The count of deno.land/x module version that have a dependency on this
* module/package/repo */
count: number;
/** The deno.land/x module that has a dependency. */
dependents: string[];
/** The specific deno.land/x module and version that has a dependency. */
dependent_versions: string[];
/** A map of the version tags and the count of specific versions.
* Dependencies that are un-versioned have a key of `$$unpinned$$`. */
versions: Record<string, number>;
}
/** Stores as kind `dependency_metrics` in the datastore. */
export interface DependencyMetrics {
/** The source label that the dependency is associated with */
source: DependencySources;
/** The count of deno_land/x module versions that have a dependency in this
* source. */
count: number;
/** A map of module/package/repo names from the source with a value of metrics
* about the */
mods: Record<string, DependencyModuleMetrics>;
}
/** Stores as kind `module_metrics` in the datastore. */
export interface ModuleMetrics {
name: string;
updated: Date;
maintenance: Record<string, never>;
popularity: {
sessions_30_day: number;
users_30_day: number;
score: number;
prev_sessions_30_day?: number;
prev_users_30_day?: number;
prev_score?: number;
};
quality: Record<string, never>;
}
/** Stores as kind `submodule_metrics` in the datastore. */
export interface SubModuleMetrics {
module: string;
submodule: string;
updated: Date;
popularity: {
sessions_30_day: number;
users_30_day: number;
score: number;
};
}
/** Stored as kind `module_version` in datastore. */
export interface ModuleVersion {
name: string;
/** If assigned, contains a text string which indicates what version of
* analysis has been done on the content. */
analysis_version?: string;
description: string;
version: string;
uploaded_at: Date;
upload_options: UploadOptions;
}
/** Stored as kind `module_entry` in datastore. */
export interface ModuleEntry {
path: string;
type: "file" | "dir";
size: number;
/** For `"dir"` entries, indicates if there is a _default_ module that should
* be used within the directory. */
default?: string;
/** For `"dir"` entries, an array of child sub-directory paths. */
dirs?: string[];
/** For `"file`" entries, indicates if the entry id can be queried for doc
* nodes. */
docable?: boolean;
/** For `"dir"` entries, an array of docable child paths that are not
* "ignored". */
index?: string[];
}
type DependencySources = keyof typeof patterns | "other";
/** Stored as kind `module_dependency` in datastore. */
export interface ModuleDependency {
/** The source for the module. If the module is not a recognized source, then
* `"other"` is used and the `pkg` field will be set to the "raw" URL. */
src: DependencySources;
/** The optional "organization" associated with dependency. For example with
* npm or GitHub style dependency, the organization that the `pkg` belongs
* to. */
org?: string;
/** The package or module name associated with the dependency. */
pkg: string;
/** The optional version or tag associated with the dependency. */
ver?: string;
}
/** Stored as kind `dependency_error` in datastore. */
export interface DependencyError {
/** The specifier the error was related to. */
specifier: string;
/** The error message. */
error: string;
}
export interface ModInfoPage {
kind: "modinfo";
module: string;
description?: string;
version: string;
versions: string[];
latest_version: string;
/** An optional array of dependencies identified for the module. */
dependencies?: ModuleDependency[];
/** An optional array of dependencies identified for the module. */
dependency_errors?: DependencyError[];
/** The default module for the module. */
defaultModule?: ModuleEntry;
/** A flag that indicates if the default module has a default export. */
defaultExport?: boolean;
/** The file entry for the module that is a README to be rendered. */
readme?: ModuleEntry;
/** The file entry for the module that has a detectable deno configuration. */
config?: ModuleEntry;
/** The file entry for an import map specified within the detectable config
* file. */
import_map?: ModuleEntry;
uploaded_at: string;
upload_options: UploadOptions;
tags?: ModuleTag[];
}
export type InfoPage = ModInfoPage | PageInvalidVersion | PageNoVersions;
export interface PageNoVersions {
kind: "no-versions";
module: string;
}
export interface PageInvalidVersion {
kind: "invalid-version";
module: string;
description?: string;
versions: string[];
latest_version: string;
}
export interface CompletionItems {
items: string[];
isIncomplete: boolean;
preselect?: string;
}
export interface PathCompletion {
path: string;
default?: string;
dirs?: string[];
modules: { path: string; doc?: string }[];
}
export interface PathCompletions {
name: string;
version: string;
items: PathCompletion[];
}