@theia/ovsx-client 1.48.0 → 1.48.1
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,170 +1,170 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2023 Ericsson and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.OVSXRouterClient = exports.createFilterFactory = void 0;
|
|
19
|
-
/**
|
|
20
|
-
* Helper function to create factories that handle a single condition key.
|
|
21
|
-
*/
|
|
22
|
-
function createFilterFactory(conditionKey, factory) {
|
|
23
|
-
return (conditions, remainingKeys) => {
|
|
24
|
-
if (conditionKey in conditions) {
|
|
25
|
-
const filter = factory(conditions[conditionKey]);
|
|
26
|
-
if (filter) {
|
|
27
|
-
remainingKeys.delete(conditionKey);
|
|
28
|
-
return filter;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
exports.createFilterFactory = createFilterFactory;
|
|
34
|
-
/**
|
|
35
|
-
* Route and agglomerate queries according to {@link routerConfig}.
|
|
36
|
-
* {@link ruleFactories} is the actual logic used to evaluate the config.
|
|
37
|
-
* Each rule implementation will be ran sequentially over each configured rule.
|
|
38
|
-
*/
|
|
39
|
-
class OVSXRouterClient {
|
|
40
|
-
constructor(useDefault, clientProvider, rules) {
|
|
41
|
-
this.useDefault = useDefault;
|
|
42
|
-
this.clientProvider = clientProvider;
|
|
43
|
-
this.rules = rules;
|
|
44
|
-
}
|
|
45
|
-
static async FromConfig(routerConfig, clientProvider, filterFactories) {
|
|
46
|
-
const rules = routerConfig.rules ? await this.ParseRules(routerConfig.rules, filterFactories, routerConfig.registries) : [];
|
|
47
|
-
return new this(this.ParseUse(routerConfig.use, routerConfig.registries), clientProvider, rules);
|
|
48
|
-
}
|
|
49
|
-
static async ParseRules(rules, filterFactories, aliases) {
|
|
50
|
-
return Promise.all(rules.map(async ({ use, ...conditions }) => {
|
|
51
|
-
const remainingKeys = new Set(Object.keys(conditions));
|
|
52
|
-
const filters = removeNullValues(await Promise.all(filterFactories.map(filterFactory => filterFactory(conditions, remainingKeys))));
|
|
53
|
-
if (remainingKeys.size > 0) {
|
|
54
|
-
throw new Error(`unknown conditions: ${Array.from(remainingKeys).join(', ')}`);
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
filters,
|
|
58
|
-
use: this.ParseUse(use, aliases)
|
|
59
|
-
};
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
static ParseUse(use, aliases) {
|
|
63
|
-
if (typeof use === 'string') {
|
|
64
|
-
return [alias(use)];
|
|
65
|
-
}
|
|
66
|
-
else if (Array.isArray(use)) {
|
|
67
|
-
return use.map(alias);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
return [];
|
|
71
|
-
}
|
|
72
|
-
function alias(aliasOrUri) {
|
|
73
|
-
var _a;
|
|
74
|
-
return (_a = aliases === null || aliases === void 0 ? void 0 : aliases[aliasOrUri]) !== null && _a !== void 0 ? _a : aliasOrUri;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
async search(searchOptions) {
|
|
78
|
-
return this.runRules(filter => { var _a; return (_a = filter.filterSearchOptions) === null || _a === void 0 ? void 0 : _a.call(filter, searchOptions); }, rule => rule.use.length > 0
|
|
79
|
-
? this.mergedSearch(rule.use, searchOptions)
|
|
80
|
-
: this.emptySearchResult(searchOptions), () => this.mergedSearch(this.useDefault, searchOptions));
|
|
81
|
-
}
|
|
82
|
-
async query(queryOptions = {}) {
|
|
83
|
-
return this.runRules(filter => { var _a; return (_a = filter.filterQueryOptions) === null || _a === void 0 ? void 0 : _a.call(filter, queryOptions); }, rule => rule.use.length > 0
|
|
84
|
-
? this.mergedQuery(rule.use, queryOptions)
|
|
85
|
-
: this.emptyQueryResult(queryOptions), () => this.mergedQuery(this.useDefault, queryOptions));
|
|
86
|
-
}
|
|
87
|
-
emptySearchResult(searchOptions) {
|
|
88
|
-
var _a;
|
|
89
|
-
return {
|
|
90
|
-
extensions: [],
|
|
91
|
-
offset: (_a = searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.offset) !== null && _a !== void 0 ? _a : 0
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
emptyQueryResult(queryOptions) {
|
|
95
|
-
return {
|
|
96
|
-
extensions: []
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
async mergedQuery(registries, queryOptions) {
|
|
100
|
-
return this.mergeQueryResults(await createMapping(registries, async (registry) => (await this.clientProvider(registry)).query(queryOptions)));
|
|
101
|
-
}
|
|
102
|
-
async mergedSearch(registries, searchOptions) {
|
|
103
|
-
return this.mergeSearchResults(await createMapping(registries, async (registry) => (await this.clientProvider(registry)).search(searchOptions)));
|
|
104
|
-
}
|
|
105
|
-
async mergeSearchResults(results) {
|
|
106
|
-
const filtering = [];
|
|
107
|
-
results.forEach((result, sourceUri) => {
|
|
108
|
-
filtering.push(Promise
|
|
109
|
-
.all(result.extensions.map(extension => this.filterExtension(sourceUri, extension)))
|
|
110
|
-
.then(removeNullValues));
|
|
111
|
-
});
|
|
112
|
-
return {
|
|
113
|
-
extensions: interleave(await Promise.all(filtering)),
|
|
114
|
-
offset: Math.min(...Array.from(results.values(), result => result.offset))
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
async mergeQueryResults(results) {
|
|
118
|
-
const filtering = [];
|
|
119
|
-
results.forEach((result, sourceUri) => {
|
|
120
|
-
result.extensions.forEach(extension => filtering.push(this.filterExtension(sourceUri, extension)));
|
|
121
|
-
});
|
|
122
|
-
return {
|
|
123
|
-
extensions: removeNullValues(await Promise.all(filtering))
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
async filterExtension(sourceUri, extension) {
|
|
127
|
-
return this.runRules(filter => { var _a; return (_a = filter.filterExtension) === null || _a === void 0 ? void 0 : _a.call(filter, extension); }, rule => rule.use.includes(sourceUri) ? extension : undefined, () => extension);
|
|
128
|
-
}
|
|
129
|
-
async runRules(runFilter, onRuleMatched, onNoRuleMatched) {
|
|
130
|
-
for (const rule of this.rules) {
|
|
131
|
-
const results = removeNullValues(await Promise.all(rule.filters.map(filter => runFilter(filter))));
|
|
132
|
-
if (results.length > 0 && results.every(value => value)) {
|
|
133
|
-
return onRuleMatched(rule);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return onNoRuleMatched === null || onNoRuleMatched === void 0 ? void 0 : onNoRuleMatched();
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
exports.OVSXRouterClient = OVSXRouterClient;
|
|
140
|
-
function nonNullable(value) {
|
|
141
|
-
// eslint-disable-next-line no-null/no-null
|
|
142
|
-
return typeof value !== 'undefined' && value !== null;
|
|
143
|
-
}
|
|
144
|
-
function removeNullValues(values) {
|
|
145
|
-
return values.filter(nonNullable);
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Create a map where the keys are each element from {@link values} and the
|
|
149
|
-
* values are the result of a mapping function applied on the key.
|
|
150
|
-
*/
|
|
151
|
-
async function createMapping(values, map, thisArg) {
|
|
152
|
-
return new Map(await Promise.all(values.map(async (value, index) => [value, await map.call(thisArg, value, index)])));
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* @example
|
|
156
|
-
* interleave([[1, 2, 3], [4, 5], [6, 7, 8]]) === [1, 4, 6, 2, 5, 7, 3, 8]
|
|
157
|
-
*/
|
|
158
|
-
function interleave(arrays) {
|
|
159
|
-
const interleaved = [];
|
|
160
|
-
const length = Math.max(...arrays.map(array => array.length));
|
|
161
|
-
for (let i = 0; i < length; i++) {
|
|
162
|
-
for (const array of arrays) {
|
|
163
|
-
if (i < array.length) {
|
|
164
|
-
interleaved.push(array[i]);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return interleaved;
|
|
169
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2023 Ericsson and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.OVSXRouterClient = exports.createFilterFactory = void 0;
|
|
19
|
+
/**
|
|
20
|
+
* Helper function to create factories that handle a single condition key.
|
|
21
|
+
*/
|
|
22
|
+
function createFilterFactory(conditionKey, factory) {
|
|
23
|
+
return (conditions, remainingKeys) => {
|
|
24
|
+
if (conditionKey in conditions) {
|
|
25
|
+
const filter = factory(conditions[conditionKey]);
|
|
26
|
+
if (filter) {
|
|
27
|
+
remainingKeys.delete(conditionKey);
|
|
28
|
+
return filter;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
exports.createFilterFactory = createFilterFactory;
|
|
34
|
+
/**
|
|
35
|
+
* Route and agglomerate queries according to {@link routerConfig}.
|
|
36
|
+
* {@link ruleFactories} is the actual logic used to evaluate the config.
|
|
37
|
+
* Each rule implementation will be ran sequentially over each configured rule.
|
|
38
|
+
*/
|
|
39
|
+
class OVSXRouterClient {
|
|
40
|
+
constructor(useDefault, clientProvider, rules) {
|
|
41
|
+
this.useDefault = useDefault;
|
|
42
|
+
this.clientProvider = clientProvider;
|
|
43
|
+
this.rules = rules;
|
|
44
|
+
}
|
|
45
|
+
static async FromConfig(routerConfig, clientProvider, filterFactories) {
|
|
46
|
+
const rules = routerConfig.rules ? await this.ParseRules(routerConfig.rules, filterFactories, routerConfig.registries) : [];
|
|
47
|
+
return new this(this.ParseUse(routerConfig.use, routerConfig.registries), clientProvider, rules);
|
|
48
|
+
}
|
|
49
|
+
static async ParseRules(rules, filterFactories, aliases) {
|
|
50
|
+
return Promise.all(rules.map(async ({ use, ...conditions }) => {
|
|
51
|
+
const remainingKeys = new Set(Object.keys(conditions));
|
|
52
|
+
const filters = removeNullValues(await Promise.all(filterFactories.map(filterFactory => filterFactory(conditions, remainingKeys))));
|
|
53
|
+
if (remainingKeys.size > 0) {
|
|
54
|
+
throw new Error(`unknown conditions: ${Array.from(remainingKeys).join(', ')}`);
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
filters,
|
|
58
|
+
use: this.ParseUse(use, aliases)
|
|
59
|
+
};
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
static ParseUse(use, aliases) {
|
|
63
|
+
if (typeof use === 'string') {
|
|
64
|
+
return [alias(use)];
|
|
65
|
+
}
|
|
66
|
+
else if (Array.isArray(use)) {
|
|
67
|
+
return use.map(alias);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
function alias(aliasOrUri) {
|
|
73
|
+
var _a;
|
|
74
|
+
return (_a = aliases === null || aliases === void 0 ? void 0 : aliases[aliasOrUri]) !== null && _a !== void 0 ? _a : aliasOrUri;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async search(searchOptions) {
|
|
78
|
+
return this.runRules(filter => { var _a; return (_a = filter.filterSearchOptions) === null || _a === void 0 ? void 0 : _a.call(filter, searchOptions); }, rule => rule.use.length > 0
|
|
79
|
+
? this.mergedSearch(rule.use, searchOptions)
|
|
80
|
+
: this.emptySearchResult(searchOptions), () => this.mergedSearch(this.useDefault, searchOptions));
|
|
81
|
+
}
|
|
82
|
+
async query(queryOptions = {}) {
|
|
83
|
+
return this.runRules(filter => { var _a; return (_a = filter.filterQueryOptions) === null || _a === void 0 ? void 0 : _a.call(filter, queryOptions); }, rule => rule.use.length > 0
|
|
84
|
+
? this.mergedQuery(rule.use, queryOptions)
|
|
85
|
+
: this.emptyQueryResult(queryOptions), () => this.mergedQuery(this.useDefault, queryOptions));
|
|
86
|
+
}
|
|
87
|
+
emptySearchResult(searchOptions) {
|
|
88
|
+
var _a;
|
|
89
|
+
return {
|
|
90
|
+
extensions: [],
|
|
91
|
+
offset: (_a = searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.offset) !== null && _a !== void 0 ? _a : 0
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
emptyQueryResult(queryOptions) {
|
|
95
|
+
return {
|
|
96
|
+
extensions: []
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
async mergedQuery(registries, queryOptions) {
|
|
100
|
+
return this.mergeQueryResults(await createMapping(registries, async (registry) => (await this.clientProvider(registry)).query(queryOptions)));
|
|
101
|
+
}
|
|
102
|
+
async mergedSearch(registries, searchOptions) {
|
|
103
|
+
return this.mergeSearchResults(await createMapping(registries, async (registry) => (await this.clientProvider(registry)).search(searchOptions)));
|
|
104
|
+
}
|
|
105
|
+
async mergeSearchResults(results) {
|
|
106
|
+
const filtering = [];
|
|
107
|
+
results.forEach((result, sourceUri) => {
|
|
108
|
+
filtering.push(Promise
|
|
109
|
+
.all(result.extensions.map(extension => this.filterExtension(sourceUri, extension)))
|
|
110
|
+
.then(removeNullValues));
|
|
111
|
+
});
|
|
112
|
+
return {
|
|
113
|
+
extensions: interleave(await Promise.all(filtering)),
|
|
114
|
+
offset: Math.min(...Array.from(results.values(), result => result.offset))
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
async mergeQueryResults(results) {
|
|
118
|
+
const filtering = [];
|
|
119
|
+
results.forEach((result, sourceUri) => {
|
|
120
|
+
result.extensions.forEach(extension => filtering.push(this.filterExtension(sourceUri, extension)));
|
|
121
|
+
});
|
|
122
|
+
return {
|
|
123
|
+
extensions: removeNullValues(await Promise.all(filtering))
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
async filterExtension(sourceUri, extension) {
|
|
127
|
+
return this.runRules(filter => { var _a; return (_a = filter.filterExtension) === null || _a === void 0 ? void 0 : _a.call(filter, extension); }, rule => rule.use.includes(sourceUri) ? extension : undefined, () => extension);
|
|
128
|
+
}
|
|
129
|
+
async runRules(runFilter, onRuleMatched, onNoRuleMatched) {
|
|
130
|
+
for (const rule of this.rules) {
|
|
131
|
+
const results = removeNullValues(await Promise.all(rule.filters.map(filter => runFilter(filter))));
|
|
132
|
+
if (results.length > 0 && results.every(value => value)) {
|
|
133
|
+
return onRuleMatched(rule);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return onNoRuleMatched === null || onNoRuleMatched === void 0 ? void 0 : onNoRuleMatched();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.OVSXRouterClient = OVSXRouterClient;
|
|
140
|
+
function nonNullable(value) {
|
|
141
|
+
// eslint-disable-next-line no-null/no-null
|
|
142
|
+
return typeof value !== 'undefined' && value !== null;
|
|
143
|
+
}
|
|
144
|
+
function removeNullValues(values) {
|
|
145
|
+
return values.filter(nonNullable);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Create a map where the keys are each element from {@link values} and the
|
|
149
|
+
* values are the result of a mapping function applied on the key.
|
|
150
|
+
*/
|
|
151
|
+
async function createMapping(values, map, thisArg) {
|
|
152
|
+
return new Map(await Promise.all(values.map(async (value, index) => [value, await map.call(thisArg, value, index)])));
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* @example
|
|
156
|
+
* interleave([[1, 2, 3], [4, 5], [6, 7, 8]]) === [1, 4, 6, 2, 5, 7, 3, 8]
|
|
157
|
+
*/
|
|
158
|
+
function interleave(arrays) {
|
|
159
|
+
const interleaved = [];
|
|
160
|
+
const length = Math.max(...arrays.map(array => array.length));
|
|
161
|
+
for (let i = 0; i < length; i++) {
|
|
162
|
+
for (const array of arrays) {
|
|
163
|
+
if (i < array.length) {
|
|
164
|
+
interleaved.push(array[i]);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return interleaved;
|
|
169
|
+
}
|
|
170
170
|
//# sourceMappingURL=ovsx-router-client.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { OVSXMockClient } from './ovsx-mock-client';
|
|
2
|
-
import { OVSXClient } from './ovsx-types';
|
|
3
|
-
export declare const registries: {
|
|
4
|
-
internal: string;
|
|
5
|
-
public: string;
|
|
6
|
-
third: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const clients: Record<string, OVSXMockClient>;
|
|
9
|
-
export declare const filterFactories: import("./ovsx-router-client").OVSXRouterFilterFactory[];
|
|
10
|
-
export declare function testClientProvider(uri: string): OVSXClient;
|
|
1
|
+
import { OVSXMockClient } from './ovsx-mock-client';
|
|
2
|
+
import { OVSXClient } from './ovsx-types';
|
|
3
|
+
export declare const registries: {
|
|
4
|
+
internal: string;
|
|
5
|
+
public: string;
|
|
6
|
+
third: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const clients: Record<string, OVSXMockClient>;
|
|
9
|
+
export declare const filterFactories: import("./ovsx-router-client").OVSXRouterFilterFactory[];
|
|
10
|
+
export declare function testClientProvider(uri: string): OVSXClient;
|
|
11
11
|
//# sourceMappingURL=ovsx-router-client.spec-data.d.ts.map
|
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2023 Ericsson and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.testClientProvider = exports.filterFactories = exports.clients = exports.registries = void 0;
|
|
19
|
-
/* eslint-disable no-null/no-null */
|
|
20
|
-
const ovsx_mock_client_1 = require("./ovsx-mock-client");
|
|
21
|
-
const ovsx_router_filters_1 = require("./ovsx-router-filters");
|
|
22
|
-
exports.registries = {
|
|
23
|
-
internal: 'https://internal.testdomain/',
|
|
24
|
-
public: 'https://public.testdomain/',
|
|
25
|
-
third: 'https://third.testdomain/'
|
|
26
|
-
};
|
|
27
|
-
exports.clients = {
|
|
28
|
-
[exports.registries.internal]: new ovsx_mock_client_1.OVSXMockClient().setExtensionsFromIds(exports.registries.internal, [
|
|
29
|
-
'some.a@1.0.0',
|
|
30
|
-
'other.d',
|
|
31
|
-
'secret.x',
|
|
32
|
-
'secret.y',
|
|
33
|
-
'secret.z',
|
|
34
|
-
...Array(50)
|
|
35
|
-
.fill(undefined)
|
|
36
|
-
.map((element, i) => `internal.autogen${i}`)
|
|
37
|
-
]),
|
|
38
|
-
[exports.registries.public]: new ovsx_mock_client_1.OVSXMockClient().setExtensionsFromIds(exports.registries.public, [
|
|
39
|
-
'some.a@2.0.0',
|
|
40
|
-
'some.b',
|
|
41
|
-
'other.e',
|
|
42
|
-
'testFullStop.c',
|
|
43
|
-
'secret.w',
|
|
44
|
-
...Array(50)
|
|
45
|
-
.fill(undefined)
|
|
46
|
-
.map((element, i) => `public.autogen${i}`)
|
|
47
|
-
]),
|
|
48
|
-
[exports.registries.third]: new ovsx_mock_client_1.OVSXMockClient().setExtensionsFromIds(exports.registries.third, [
|
|
49
|
-
...Array(200)
|
|
50
|
-
.fill(undefined)
|
|
51
|
-
.map((element, i) => `third.autogen${i}`)
|
|
52
|
-
])
|
|
53
|
-
};
|
|
54
|
-
exports.filterFactories = [
|
|
55
|
-
ovsx_router_filters_1.RequestContainsFilterFactory,
|
|
56
|
-
ovsx_router_filters_1.ExtensionIdMatchesFilterFactory
|
|
57
|
-
];
|
|
58
|
-
function testClientProvider(uri) {
|
|
59
|
-
const client = exports.clients[uri];
|
|
60
|
-
if (!client) {
|
|
61
|
-
throw new Error(`unknown client for URI=${uri}`);
|
|
62
|
-
}
|
|
63
|
-
return client;
|
|
64
|
-
}
|
|
65
|
-
exports.testClientProvider = testClientProvider;
|
|
66
|
-
;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2023 Ericsson and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.testClientProvider = exports.filterFactories = exports.clients = exports.registries = void 0;
|
|
19
|
+
/* eslint-disable no-null/no-null */
|
|
20
|
+
const ovsx_mock_client_1 = require("./ovsx-mock-client");
|
|
21
|
+
const ovsx_router_filters_1 = require("./ovsx-router-filters");
|
|
22
|
+
exports.registries = {
|
|
23
|
+
internal: 'https://internal.testdomain/',
|
|
24
|
+
public: 'https://public.testdomain/',
|
|
25
|
+
third: 'https://third.testdomain/'
|
|
26
|
+
};
|
|
27
|
+
exports.clients = {
|
|
28
|
+
[exports.registries.internal]: new ovsx_mock_client_1.OVSXMockClient().setExtensionsFromIds(exports.registries.internal, [
|
|
29
|
+
'some.a@1.0.0',
|
|
30
|
+
'other.d',
|
|
31
|
+
'secret.x',
|
|
32
|
+
'secret.y',
|
|
33
|
+
'secret.z',
|
|
34
|
+
...Array(50)
|
|
35
|
+
.fill(undefined)
|
|
36
|
+
.map((element, i) => `internal.autogen${i}`)
|
|
37
|
+
]),
|
|
38
|
+
[exports.registries.public]: new ovsx_mock_client_1.OVSXMockClient().setExtensionsFromIds(exports.registries.public, [
|
|
39
|
+
'some.a@2.0.0',
|
|
40
|
+
'some.b',
|
|
41
|
+
'other.e',
|
|
42
|
+
'testFullStop.c',
|
|
43
|
+
'secret.w',
|
|
44
|
+
...Array(50)
|
|
45
|
+
.fill(undefined)
|
|
46
|
+
.map((element, i) => `public.autogen${i}`)
|
|
47
|
+
]),
|
|
48
|
+
[exports.registries.third]: new ovsx_mock_client_1.OVSXMockClient().setExtensionsFromIds(exports.registries.third, [
|
|
49
|
+
...Array(200)
|
|
50
|
+
.fill(undefined)
|
|
51
|
+
.map((element, i) => `third.autogen${i}`)
|
|
52
|
+
])
|
|
53
|
+
};
|
|
54
|
+
exports.filterFactories = [
|
|
55
|
+
ovsx_router_filters_1.RequestContainsFilterFactory,
|
|
56
|
+
ovsx_router_filters_1.ExtensionIdMatchesFilterFactory
|
|
57
|
+
];
|
|
58
|
+
function testClientProvider(uri) {
|
|
59
|
+
const client = exports.clients[uri];
|
|
60
|
+
if (!client) {
|
|
61
|
+
throw new Error(`unknown client for URI=${uri}`);
|
|
62
|
+
}
|
|
63
|
+
return client;
|
|
64
|
+
}
|
|
65
|
+
exports.testClientProvider = testClientProvider;
|
|
66
|
+
;
|
|
67
67
|
//# sourceMappingURL=ovsx-router-client.spec-data.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=ovsx-router-client.spec.d.ts.map
|