@theia/ovsx-client 1.48.1 → 1.48.3
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/README.md +61 -61
- package/lib/index.d.ts +6 -6
- package/lib/index.js +30 -30
- package/lib/ovsx-api-filter.d.ts +30 -30
- package/lib/ovsx-api-filter.js +73 -73
- package/lib/ovsx-http-client.d.ts +17 -17
- package/lib/ovsx-http-client.js +82 -82
- package/lib/ovsx-mock-client.d.ts +43 -43
- package/lib/ovsx-mock-client.js +168 -168
- package/lib/ovsx-router-client.d.ts +68 -68
- package/lib/ovsx-router-client.js +169 -169
- package/lib/ovsx-router-client.spec-data.d.ts +10 -10
- package/lib/ovsx-router-client.spec-data.js +66 -66
- package/lib/ovsx-router-client.spec.d.ts +1 -1
- package/lib/ovsx-router-client.spec.js +107 -107
- package/lib/ovsx-router-filters/abstract-reg-exp-filter.d.ts +5 -5
- package/lib/ovsx-router-filters/abstract-reg-exp-filter.js +27 -27
- package/lib/ovsx-router-filters/extension-id-matches-filter.d.ts +7 -7
- package/lib/ovsx-router-filters/extension-id-matches-filter.js +33 -33
- package/lib/ovsx-router-filters/index.d.ts +2 -2
- package/lib/ovsx-router-filters/index.js +22 -22
- package/lib/ovsx-router-filters/request-contains-filter.d.ts +8 -8
- package/lib/ovsx-router-filters/request-contains-filter.js +35 -35
- package/lib/ovsx-types.d.ts +212 -212
- package/lib/ovsx-types.js +74 -74
- package/lib/types.d.ts +1 -1
- package/lib/types.js +17 -17
- package/package.json +3 -3
- package/src/index.ts +22 -22
- package/src/ovsx-api-filter.ts +91 -91
- package/src/ovsx-http-client.ts +85 -85
- package/src/ovsx-mock-client.ts +182 -182
- package/src/ovsx-router-client.spec-data.ts +68 -68
- package/src/ovsx-router-client.spec.ts +126 -126
- package/src/ovsx-router-client.ts +248 -248
- package/src/ovsx-router-filters/abstract-reg-exp-filter.ts +26 -26
- package/src/ovsx-router-filters/extension-id-matches-filter.ts +32 -32
- package/src/ovsx-router-filters/index.ts +18 -18
- package/src/ovsx-router-filters/request-contains-filter.ts +35 -35
- package/src/ovsx-types.ts +268 -268
- package/src/types.ts +17 -17
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2023 Ericsson and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { createFilterFactory, OVSXRouterFilter } from '../ovsx-router-client';
|
|
18
|
-
import { VSXQueryOptions, VSXSearchOptions } from '../ovsx-types';
|
|
19
|
-
import { AbstractRegExpFilter } from './abstract-reg-exp-filter';
|
|
20
|
-
|
|
21
|
-
export const RequestContainsFilterFactory = createFilterFactory('ifRequestContains', ifRequestContains => {
|
|
22
|
-
if (typeof ifRequestContains !== 'string') {
|
|
23
|
-
throw new TypeError(`expected a string, got: ${typeof ifRequestContains}`);
|
|
24
|
-
}
|
|
25
|
-
return new RequestContainsFilter(new RegExp(ifRequestContains, 'i'));
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
export class RequestContainsFilter extends AbstractRegExpFilter implements OVSXRouterFilter {
|
|
29
|
-
filterSearchOptions(searchOptions?: VSXSearchOptions): boolean {
|
|
30
|
-
return !searchOptions || this.test(searchOptions.query) || this.test(searchOptions.category);
|
|
31
|
-
}
|
|
32
|
-
filterQueryOptions(queryOptions?: VSXQueryOptions): boolean {
|
|
33
|
-
return !queryOptions || Object.values(queryOptions).some(this.test, this);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 Ericsson and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { createFilterFactory, OVSXRouterFilter } from '../ovsx-router-client';
|
|
18
|
+
import { VSXQueryOptions, VSXSearchOptions } from '../ovsx-types';
|
|
19
|
+
import { AbstractRegExpFilter } from './abstract-reg-exp-filter';
|
|
20
|
+
|
|
21
|
+
export const RequestContainsFilterFactory = createFilterFactory('ifRequestContains', ifRequestContains => {
|
|
22
|
+
if (typeof ifRequestContains !== 'string') {
|
|
23
|
+
throw new TypeError(`expected a string, got: ${typeof ifRequestContains}`);
|
|
24
|
+
}
|
|
25
|
+
return new RequestContainsFilter(new RegExp(ifRequestContains, 'i'));
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export class RequestContainsFilter extends AbstractRegExpFilter implements OVSXRouterFilter {
|
|
29
|
+
filterSearchOptions(searchOptions?: VSXSearchOptions): boolean {
|
|
30
|
+
return !searchOptions || this.test(searchOptions.query) || this.test(searchOptions.category);
|
|
31
|
+
}
|
|
32
|
+
filterQueryOptions(queryOptions?: VSXQueryOptions): boolean {
|
|
33
|
+
return !queryOptions || Object.values(queryOptions).some(this.test, this);
|
|
34
|
+
}
|
|
35
|
+
}
|
package/src/ovsx-types.ts
CHANGED
|
@@ -1,268 +1,268 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2020 TypeFox and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { MaybePromise } from './types';
|
|
18
|
-
|
|
19
|
-
export interface ExtensionLike {
|
|
20
|
-
name: string;
|
|
21
|
-
namespace: string;
|
|
22
|
-
version?: string;
|
|
23
|
-
}
|
|
24
|
-
export namespace ExtensionLike {
|
|
25
|
-
export function id<T extends ExtensionLike>(extension: T): `${string}.${string}` {
|
|
26
|
-
return `${extension.namespace}.${extension.name}`;
|
|
27
|
-
}
|
|
28
|
-
export function idWithVersion<T extends ExtensionLike>(extension: T): `${string}.${string}@${string}` {
|
|
29
|
-
if (!extension.version) {
|
|
30
|
-
throw new Error(`no valid "version" value provided for "${id(extension)}"`);
|
|
31
|
-
}
|
|
32
|
-
return `${id(extension)}@${extension.version}`;
|
|
33
|
-
}
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
35
|
-
export function fromId(id: string): ExtensionLike {
|
|
36
|
-
const [left, version] = id.split('@', 2);
|
|
37
|
-
const [namespace, name] = left.split('.', 2);
|
|
38
|
-
return {
|
|
39
|
-
name,
|
|
40
|
-
namespace,
|
|
41
|
-
version
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface OVSXClient {
|
|
47
|
-
/**
|
|
48
|
-
* GET https://openvsx.org/api/-/search
|
|
49
|
-
*/
|
|
50
|
-
search(searchOptions?: VSXSearchOptions): Promise<VSXSearchResult>;
|
|
51
|
-
/**
|
|
52
|
-
* GET https://openvsx.org/api/-/query
|
|
53
|
-
*
|
|
54
|
-
* Fetch one or all versions of an extension.
|
|
55
|
-
*/
|
|
56
|
-
query(queryOptions?: VSXQueryOptions): Promise<VSXQueryResult>;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** @deprecated since 1.31.0 use {@link VSXSearchOptions} instead */
|
|
60
|
-
export type VSXSearchParam = VSXSearchOptions;
|
|
61
|
-
/**
|
|
62
|
-
* The possible options when performing a search.
|
|
63
|
-
*
|
|
64
|
-
* For available options, and default values consult the `swagger`: https://open-vsx.org/swagger-ui/index.html.
|
|
65
|
-
*
|
|
66
|
-
* Should be aligned with https://github.com/eclipse/openvsx/blob/b5694a712e07d266801394916bac30609e16d77b/server/src/main/java/org/eclipse/openvsx/RegistryAPI.java#L246-L266
|
|
67
|
-
*/
|
|
68
|
-
export interface VSXSearchOptions {
|
|
69
|
-
/**
|
|
70
|
-
* The query text for searching.
|
|
71
|
-
*/
|
|
72
|
-
query?: string;
|
|
73
|
-
/**
|
|
74
|
-
* The extension category.
|
|
75
|
-
*/
|
|
76
|
-
category?: string;
|
|
77
|
-
/**
|
|
78
|
-
* The maximum number of entries to return.
|
|
79
|
-
*/
|
|
80
|
-
size?: number;
|
|
81
|
-
/**
|
|
82
|
-
* The number of entries to skip (usually a multiple of the page size).
|
|
83
|
-
*/
|
|
84
|
-
offset?: number;
|
|
85
|
-
/**
|
|
86
|
-
* The sort order.
|
|
87
|
-
*/
|
|
88
|
-
sortOrder?: 'asc' | 'desc';
|
|
89
|
-
/**
|
|
90
|
-
* The sort key.
|
|
91
|
-
*/
|
|
92
|
-
sortBy?: 'averageRating' | 'downloadCount' | 'relevance' | 'timestamp';
|
|
93
|
-
/**
|
|
94
|
-
* By default an OpenVSX registry will return the last known version of
|
|
95
|
-
* extensions. Setting this field to `true` will have the registry specify
|
|
96
|
-
* the {@link VSXExtensionRaw.allVersions} field which references all known
|
|
97
|
-
* versions for each returned extension.
|
|
98
|
-
*
|
|
99
|
-
* @default false
|
|
100
|
-
*/
|
|
101
|
-
includeAllVersions?: boolean;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Should be aligned with https://github.com/eclipse/openvsx/blob/e8f64fe145fc05d2de1469735d50a7a90e400bc4/server/src/main/java/org/eclipse/openvsx/json/SearchResultJson.java
|
|
106
|
-
*/
|
|
107
|
-
export interface VSXSearchResult {
|
|
108
|
-
error?: string;
|
|
109
|
-
offset: number;
|
|
110
|
-
extensions: VSXSearchEntry[];
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/** @deprecated since 1.31.0 use {@link VSXQueryOptions} instead */
|
|
114
|
-
export type VSXQueryParam = VSXQueryOptions;
|
|
115
|
-
/**
|
|
116
|
-
* The possible options when performing a search.
|
|
117
|
-
*
|
|
118
|
-
* For available options, and default values consult the `swagger`: https://open-vsx.org/swagger-ui/index.html.
|
|
119
|
-
*
|
|
120
|
-
* Should be aligned with https://github.com/eclipse/openvsx/blob/b5694a712e07d266801394916bac30609e16d77b/server/src/main/java/org/eclipse/openvsx/json/QueryParamJson.java#L18-L46
|
|
121
|
-
*/
|
|
122
|
-
export interface VSXQueryOptions {
|
|
123
|
-
namespaceName?: string;
|
|
124
|
-
extensionName?: string;
|
|
125
|
-
extensionVersion?: string;
|
|
126
|
-
extensionId?: string;
|
|
127
|
-
extensionUuid?: string;
|
|
128
|
-
namespaceUuid?: string;
|
|
129
|
-
includeAllVersions?: boolean;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export interface VSXQueryResult {
|
|
133
|
-
extensions: VSXExtensionRaw[];
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* This type describes the data as found in {@link VSXSearchEntry.allVersions}.
|
|
138
|
-
*
|
|
139
|
-
* Note that this type only represents one version of a given plugin, despite the name.
|
|
140
|
-
*/
|
|
141
|
-
export interface VSXAllVersions {
|
|
142
|
-
url: string;
|
|
143
|
-
version: string;
|
|
144
|
-
engines?: {
|
|
145
|
-
[version: string]: string;
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Should be aligned with https://github.com/eclipse/openvsx/blob/master/server/src/main/java/org/eclipse/openvsx/json/SearchEntryJson.java
|
|
151
|
-
*/
|
|
152
|
-
export interface VSXSearchEntry {
|
|
153
|
-
url: string;
|
|
154
|
-
files: {
|
|
155
|
-
download: string;
|
|
156
|
-
manifest?: string;
|
|
157
|
-
readme?: string;
|
|
158
|
-
license?: string;
|
|
159
|
-
icon?: string;
|
|
160
|
-
};
|
|
161
|
-
name: string;
|
|
162
|
-
namespace: string;
|
|
163
|
-
version: string;
|
|
164
|
-
timestamp: string;
|
|
165
|
-
averageRating?: number;
|
|
166
|
-
downloadCount: number;
|
|
167
|
-
displayName?: string;
|
|
168
|
-
description?: string;
|
|
169
|
-
/**
|
|
170
|
-
* May be undefined when {@link VSXSearchOptions.includeAllVersions} is
|
|
171
|
-
* `false` or `undefined`.
|
|
172
|
-
*/
|
|
173
|
-
allVersions?: VSXAllVersions[];
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export type VSXExtensionNamespaceAccess = 'public' | 'restricted';
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Should be aligned with https://github.com/eclipse/openvsx/blob/master/server/src/main/java/org/eclipse/openvsx/json/UserJson.java
|
|
180
|
-
*/
|
|
181
|
-
export interface VSXUser {
|
|
182
|
-
loginName: string;
|
|
183
|
-
homepage?: string;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export interface VSXExtensionRawFiles {
|
|
187
|
-
download: string;
|
|
188
|
-
readme?: string;
|
|
189
|
-
license?: string;
|
|
190
|
-
icon?: string;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Should be aligned with https://github.com/eclipse/openvsx/blob/master/server/src/main/java/org/eclipse/openvsx/json/ExtensionJson.java
|
|
195
|
-
*/
|
|
196
|
-
export interface VSXExtensionRaw {
|
|
197
|
-
error?: string;
|
|
198
|
-
namespaceUrl: string;
|
|
199
|
-
reviewsUrl: string;
|
|
200
|
-
name: string;
|
|
201
|
-
namespace: string;
|
|
202
|
-
publishedBy: VSXUser
|
|
203
|
-
namespaceAccess: VSXExtensionNamespaceAccess;
|
|
204
|
-
files: VSXExtensionRawFiles;
|
|
205
|
-
allVersions: {
|
|
206
|
-
[version: string]: string;
|
|
207
|
-
};
|
|
208
|
-
averageRating?: number;
|
|
209
|
-
downloadCount: number;
|
|
210
|
-
reviewCount: number;
|
|
211
|
-
version: string;
|
|
212
|
-
timestamp: string;
|
|
213
|
-
preview?: boolean;
|
|
214
|
-
verified?: boolean;
|
|
215
|
-
displayName?: string;
|
|
216
|
-
description?: string;
|
|
217
|
-
categories?: string[];
|
|
218
|
-
tags?: string[];
|
|
219
|
-
license?: string;
|
|
220
|
-
homepage?: string;
|
|
221
|
-
repository?: string;
|
|
222
|
-
bugs?: string;
|
|
223
|
-
markdown?: string;
|
|
224
|
-
galleryColor?: string;
|
|
225
|
-
galleryTheme?: string;
|
|
226
|
-
qna?: string;
|
|
227
|
-
engines?: {
|
|
228
|
-
[engine: string]: string;
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
export interface VSXResponseError extends Error {
|
|
233
|
-
statusCode: number;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
export namespace VSXResponseError {
|
|
237
|
-
export function is(error: unknown): error is VSXResponseError {
|
|
238
|
-
return !!error && typeof error === 'object' && typeof (error as VSXResponseError).statusCode === 'number';
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Builtin namespaces maintained by the framework.
|
|
244
|
-
*/
|
|
245
|
-
export namespace VSXBuiltinNamespaces {
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Namespace for individual vscode builtin extensions.
|
|
249
|
-
*/
|
|
250
|
-
export const VSCODE = 'vscode';
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Namespace for vscode builtin extension packs.
|
|
254
|
-
* - corresponds to: https://github.com/eclipse-theia/vscode-builtin-extensions/blob/af9cfeb2ea23e1668a8340c1c2fb5afd56be07d7/src/create-extension-pack.js#L45
|
|
255
|
-
*/
|
|
256
|
-
export const THEIA = 'eclipse-theia';
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Determines if the extension namespace is a builtin maintained by the framework.
|
|
260
|
-
* @param namespace the extension namespace to verify.
|
|
261
|
-
*/
|
|
262
|
-
export function is(namespace: string): boolean {
|
|
263
|
-
return namespace === VSCODE
|
|
264
|
-
|| namespace === THEIA;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
export type OVSXClientProvider = (uri: string) => MaybePromise<OVSXClient>;
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2020 TypeFox and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { MaybePromise } from './types';
|
|
18
|
+
|
|
19
|
+
export interface ExtensionLike {
|
|
20
|
+
name: string;
|
|
21
|
+
namespace: string;
|
|
22
|
+
version?: string;
|
|
23
|
+
}
|
|
24
|
+
export namespace ExtensionLike {
|
|
25
|
+
export function id<T extends ExtensionLike>(extension: T): `${string}.${string}` {
|
|
26
|
+
return `${extension.namespace}.${extension.name}`;
|
|
27
|
+
}
|
|
28
|
+
export function idWithVersion<T extends ExtensionLike>(extension: T): `${string}.${string}@${string}` {
|
|
29
|
+
if (!extension.version) {
|
|
30
|
+
throw new Error(`no valid "version" value provided for "${id(extension)}"`);
|
|
31
|
+
}
|
|
32
|
+
return `${id(extension)}@${extension.version}`;
|
|
33
|
+
}
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
35
|
+
export function fromId(id: string): ExtensionLike {
|
|
36
|
+
const [left, version] = id.split('@', 2);
|
|
37
|
+
const [namespace, name] = left.split('.', 2);
|
|
38
|
+
return {
|
|
39
|
+
name,
|
|
40
|
+
namespace,
|
|
41
|
+
version
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface OVSXClient {
|
|
47
|
+
/**
|
|
48
|
+
* GET https://openvsx.org/api/-/search
|
|
49
|
+
*/
|
|
50
|
+
search(searchOptions?: VSXSearchOptions): Promise<VSXSearchResult>;
|
|
51
|
+
/**
|
|
52
|
+
* GET https://openvsx.org/api/-/query
|
|
53
|
+
*
|
|
54
|
+
* Fetch one or all versions of an extension.
|
|
55
|
+
*/
|
|
56
|
+
query(queryOptions?: VSXQueryOptions): Promise<VSXQueryResult>;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** @deprecated since 1.31.0 use {@link VSXSearchOptions} instead */
|
|
60
|
+
export type VSXSearchParam = VSXSearchOptions;
|
|
61
|
+
/**
|
|
62
|
+
* The possible options when performing a search.
|
|
63
|
+
*
|
|
64
|
+
* For available options, and default values consult the `swagger`: https://open-vsx.org/swagger-ui/index.html.
|
|
65
|
+
*
|
|
66
|
+
* Should be aligned with https://github.com/eclipse/openvsx/blob/b5694a712e07d266801394916bac30609e16d77b/server/src/main/java/org/eclipse/openvsx/RegistryAPI.java#L246-L266
|
|
67
|
+
*/
|
|
68
|
+
export interface VSXSearchOptions {
|
|
69
|
+
/**
|
|
70
|
+
* The query text for searching.
|
|
71
|
+
*/
|
|
72
|
+
query?: string;
|
|
73
|
+
/**
|
|
74
|
+
* The extension category.
|
|
75
|
+
*/
|
|
76
|
+
category?: string;
|
|
77
|
+
/**
|
|
78
|
+
* The maximum number of entries to return.
|
|
79
|
+
*/
|
|
80
|
+
size?: number;
|
|
81
|
+
/**
|
|
82
|
+
* The number of entries to skip (usually a multiple of the page size).
|
|
83
|
+
*/
|
|
84
|
+
offset?: number;
|
|
85
|
+
/**
|
|
86
|
+
* The sort order.
|
|
87
|
+
*/
|
|
88
|
+
sortOrder?: 'asc' | 'desc';
|
|
89
|
+
/**
|
|
90
|
+
* The sort key.
|
|
91
|
+
*/
|
|
92
|
+
sortBy?: 'averageRating' | 'downloadCount' | 'relevance' | 'timestamp';
|
|
93
|
+
/**
|
|
94
|
+
* By default an OpenVSX registry will return the last known version of
|
|
95
|
+
* extensions. Setting this field to `true` will have the registry specify
|
|
96
|
+
* the {@link VSXExtensionRaw.allVersions} field which references all known
|
|
97
|
+
* versions for each returned extension.
|
|
98
|
+
*
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
includeAllVersions?: boolean;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Should be aligned with https://github.com/eclipse/openvsx/blob/e8f64fe145fc05d2de1469735d50a7a90e400bc4/server/src/main/java/org/eclipse/openvsx/json/SearchResultJson.java
|
|
106
|
+
*/
|
|
107
|
+
export interface VSXSearchResult {
|
|
108
|
+
error?: string;
|
|
109
|
+
offset: number;
|
|
110
|
+
extensions: VSXSearchEntry[];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** @deprecated since 1.31.0 use {@link VSXQueryOptions} instead */
|
|
114
|
+
export type VSXQueryParam = VSXQueryOptions;
|
|
115
|
+
/**
|
|
116
|
+
* The possible options when performing a search.
|
|
117
|
+
*
|
|
118
|
+
* For available options, and default values consult the `swagger`: https://open-vsx.org/swagger-ui/index.html.
|
|
119
|
+
*
|
|
120
|
+
* Should be aligned with https://github.com/eclipse/openvsx/blob/b5694a712e07d266801394916bac30609e16d77b/server/src/main/java/org/eclipse/openvsx/json/QueryParamJson.java#L18-L46
|
|
121
|
+
*/
|
|
122
|
+
export interface VSXQueryOptions {
|
|
123
|
+
namespaceName?: string;
|
|
124
|
+
extensionName?: string;
|
|
125
|
+
extensionVersion?: string;
|
|
126
|
+
extensionId?: string;
|
|
127
|
+
extensionUuid?: string;
|
|
128
|
+
namespaceUuid?: string;
|
|
129
|
+
includeAllVersions?: boolean;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface VSXQueryResult {
|
|
133
|
+
extensions: VSXExtensionRaw[];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* This type describes the data as found in {@link VSXSearchEntry.allVersions}.
|
|
138
|
+
*
|
|
139
|
+
* Note that this type only represents one version of a given plugin, despite the name.
|
|
140
|
+
*/
|
|
141
|
+
export interface VSXAllVersions {
|
|
142
|
+
url: string;
|
|
143
|
+
version: string;
|
|
144
|
+
engines?: {
|
|
145
|
+
[version: string]: string;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Should be aligned with https://github.com/eclipse/openvsx/blob/master/server/src/main/java/org/eclipse/openvsx/json/SearchEntryJson.java
|
|
151
|
+
*/
|
|
152
|
+
export interface VSXSearchEntry {
|
|
153
|
+
url: string;
|
|
154
|
+
files: {
|
|
155
|
+
download: string;
|
|
156
|
+
manifest?: string;
|
|
157
|
+
readme?: string;
|
|
158
|
+
license?: string;
|
|
159
|
+
icon?: string;
|
|
160
|
+
};
|
|
161
|
+
name: string;
|
|
162
|
+
namespace: string;
|
|
163
|
+
version: string;
|
|
164
|
+
timestamp: string;
|
|
165
|
+
averageRating?: number;
|
|
166
|
+
downloadCount: number;
|
|
167
|
+
displayName?: string;
|
|
168
|
+
description?: string;
|
|
169
|
+
/**
|
|
170
|
+
* May be undefined when {@link VSXSearchOptions.includeAllVersions} is
|
|
171
|
+
* `false` or `undefined`.
|
|
172
|
+
*/
|
|
173
|
+
allVersions?: VSXAllVersions[];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export type VSXExtensionNamespaceAccess = 'public' | 'restricted';
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Should be aligned with https://github.com/eclipse/openvsx/blob/master/server/src/main/java/org/eclipse/openvsx/json/UserJson.java
|
|
180
|
+
*/
|
|
181
|
+
export interface VSXUser {
|
|
182
|
+
loginName: string;
|
|
183
|
+
homepage?: string;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface VSXExtensionRawFiles {
|
|
187
|
+
download: string;
|
|
188
|
+
readme?: string;
|
|
189
|
+
license?: string;
|
|
190
|
+
icon?: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Should be aligned with https://github.com/eclipse/openvsx/blob/master/server/src/main/java/org/eclipse/openvsx/json/ExtensionJson.java
|
|
195
|
+
*/
|
|
196
|
+
export interface VSXExtensionRaw {
|
|
197
|
+
error?: string;
|
|
198
|
+
namespaceUrl: string;
|
|
199
|
+
reviewsUrl: string;
|
|
200
|
+
name: string;
|
|
201
|
+
namespace: string;
|
|
202
|
+
publishedBy: VSXUser
|
|
203
|
+
namespaceAccess: VSXExtensionNamespaceAccess;
|
|
204
|
+
files: VSXExtensionRawFiles;
|
|
205
|
+
allVersions: {
|
|
206
|
+
[version: string]: string;
|
|
207
|
+
};
|
|
208
|
+
averageRating?: number;
|
|
209
|
+
downloadCount: number;
|
|
210
|
+
reviewCount: number;
|
|
211
|
+
version: string;
|
|
212
|
+
timestamp: string;
|
|
213
|
+
preview?: boolean;
|
|
214
|
+
verified?: boolean;
|
|
215
|
+
displayName?: string;
|
|
216
|
+
description?: string;
|
|
217
|
+
categories?: string[];
|
|
218
|
+
tags?: string[];
|
|
219
|
+
license?: string;
|
|
220
|
+
homepage?: string;
|
|
221
|
+
repository?: string;
|
|
222
|
+
bugs?: string;
|
|
223
|
+
markdown?: string;
|
|
224
|
+
galleryColor?: string;
|
|
225
|
+
galleryTheme?: string;
|
|
226
|
+
qna?: string;
|
|
227
|
+
engines?: {
|
|
228
|
+
[engine: string]: string;
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface VSXResponseError extends Error {
|
|
233
|
+
statusCode: number;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export namespace VSXResponseError {
|
|
237
|
+
export function is(error: unknown): error is VSXResponseError {
|
|
238
|
+
return !!error && typeof error === 'object' && typeof (error as VSXResponseError).statusCode === 'number';
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Builtin namespaces maintained by the framework.
|
|
244
|
+
*/
|
|
245
|
+
export namespace VSXBuiltinNamespaces {
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Namespace for individual vscode builtin extensions.
|
|
249
|
+
*/
|
|
250
|
+
export const VSCODE = 'vscode';
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Namespace for vscode builtin extension packs.
|
|
254
|
+
* - corresponds to: https://github.com/eclipse-theia/vscode-builtin-extensions/blob/af9cfeb2ea23e1668a8340c1c2fb5afd56be07d7/src/create-extension-pack.js#L45
|
|
255
|
+
*/
|
|
256
|
+
export const THEIA = 'eclipse-theia';
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Determines if the extension namespace is a builtin maintained by the framework.
|
|
260
|
+
* @param namespace the extension namespace to verify.
|
|
261
|
+
*/
|
|
262
|
+
export function is(namespace: string): boolean {
|
|
263
|
+
return namespace === VSCODE
|
|
264
|
+
|| namespace === THEIA;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export type OVSXClientProvider = (uri: string) => MaybePromise<OVSXClient>;
|
package/src/types.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2023 Ericsson and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
export type MaybePromise<T> = T | PromiseLike<T>;
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 Ericsson and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
export type MaybePromise<T> = T | PromiseLike<T>;
|