@hahnpro/hpc-api 2025.2.0 → 2025.2.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/CHANGELOG.md +1 -1
- package/package.json +7 -10
- package/src/index.js +20 -27
- package/src/lib/Queue.js +10 -21
- package/src/lib/api-base.js +3 -15
- package/src/lib/api.js +42 -53
- package/src/lib/asset.interface.js +1 -6
- package/src/lib/asset.service.js +20 -45
- package/src/lib/assettypes.service.js +12 -26
- package/src/lib/content.interface.js +3 -15
- package/src/lib/content.service.js +32 -62
- package/src/lib/data.interface.js +1 -13
- package/src/lib/data.service.js +24 -45
- package/src/lib/endpoint.interface.js +1 -6
- package/src/lib/endpoint.service.js +4 -16
- package/src/lib/events.interface.js +1 -6
- package/src/lib/events.service.js +4 -16
- package/src/lib/flow-deployment.interface.js +1 -6
- package/src/lib/flow-deployment.service.js +25 -58
- package/src/lib/flow-function.interface.js +1 -6
- package/src/lib/flow-function.service.js +6 -20
- package/src/lib/flow-module.interface.js +1 -6
- package/src/lib/flow-module.service.js +6 -20
- package/src/lib/flow.interface.js +1 -6
- package/src/lib/flow.service.js +13 -27
- package/src/lib/http.service.d.ts +1 -2
- package/src/lib/http.service.js +66 -101
- package/src/lib/label.interface.js +1 -6
- package/src/lib/label.service.js +5 -17
- package/src/lib/mock/api-base.mock.js +6 -17
- package/src/lib/mock/api.mock.d.ts +24 -22
- package/src/lib/mock/api.mock.js +195 -205
- package/src/lib/mock/asset.mock.service.js +38 -55
- package/src/lib/mock/assetTypes.mock.service.js +27 -45
- package/src/lib/mock/content.mock.service.js +37 -45
- package/src/lib/mock/data.mock.service.js +40 -49
- package/src/lib/mock/endpoint.mock.service.js +5 -17
- package/src/lib/mock/events.mock.service.js +4 -16
- package/src/lib/mock/flow-deployment.mock.service.js +36 -81
- package/src/lib/mock/flow-functions.mock.service.js +20 -33
- package/src/lib/mock/flow-modules.mock.service.js +6 -18
- package/src/lib/mock/flow.mock.service.js +29 -44
- package/src/lib/mock/http.mock.service.d.ts +28 -0
- package/src/lib/mock/http.mock.service.js +35 -0
- package/src/lib/mock/index.d.ts +1 -0
- package/src/lib/mock/index.js +12 -18
- package/src/lib/mock/label.mock.service.js +5 -17
- package/src/lib/mock/notification.mock.service.js +4 -16
- package/src/lib/mock/secret.mock.service.js +12 -24
- package/src/lib/mock/task.mock.service.js +12 -24
- package/src/lib/mock/timeseries.mock.service.js +43 -88
- package/src/lib/mock/trash.mock.service.js +14 -28
- package/src/lib/mock/user.mock.service.js +6 -17
- package/src/lib/mock/vault.mock.service.js +5 -17
- package/src/lib/notification.interface.js +1 -6
- package/src/lib/notification.service.js +4 -16
- package/src/lib/proxy.service.js +7 -19
- package/src/lib/resource.interface.js +1 -6
- package/src/lib/schema.interface.js +1 -6
- package/src/lib/secret.interface.js +1 -6
- package/src/lib/secret.service.js +11 -23
- package/src/lib/storage.interface.js +1 -6
- package/src/lib/task.interface.js +1 -6
- package/src/lib/task.service.js +11 -23
- package/src/lib/timeseries.interface.js +1 -6
- package/src/lib/timeseries.service.js +66 -97
- package/src/lib/token-set.js +3 -15
- package/src/lib/trash.service.js +5 -23
- package/src/lib/user-settings.interface.js +1 -6
- package/src/lib/user.service.js +7 -18
- package/src/lib/vault.interface.js +1 -6
- package/src/lib/vault.service.js +6 -23
- package/src/index.js.map +0 -1
- package/src/lib/Queue.js.map +0 -1
- package/src/lib/api-base.js.map +0 -1
- package/src/lib/api.js.map +0 -1
- package/src/lib/asset.interface.js.map +0 -1
- package/src/lib/asset.service.js.map +0 -1
- package/src/lib/assettypes.service.js.map +0 -1
- package/src/lib/content.interface.js.map +0 -1
- package/src/lib/content.service.js.map +0 -1
- package/src/lib/data.interface.js.map +0 -1
- package/src/lib/data.service.js.map +0 -1
- package/src/lib/endpoint.interface.js.map +0 -1
- package/src/lib/endpoint.service.js.map +0 -1
- package/src/lib/events.interface.js.map +0 -1
- package/src/lib/events.service.js.map +0 -1
- package/src/lib/flow-deployment.interface.js.map +0 -1
- package/src/lib/flow-deployment.service.js.map +0 -1
- package/src/lib/flow-function.interface.js.map +0 -1
- package/src/lib/flow-function.service.js.map +0 -1
- package/src/lib/flow-module.interface.js.map +0 -1
- package/src/lib/flow-module.service.js.map +0 -1
- package/src/lib/flow.interface.js.map +0 -1
- package/src/lib/flow.service.js.map +0 -1
- package/src/lib/http.service.js.map +0 -1
- package/src/lib/label.interface.js.map +0 -1
- package/src/lib/label.service.js.map +0 -1
- package/src/lib/mock/api-base.mock.js.map +0 -1
- package/src/lib/mock/api.mock.js.map +0 -1
- package/src/lib/mock/asset.mock.service.js.map +0 -1
- package/src/lib/mock/assetTypes.mock.service.js.map +0 -1
- package/src/lib/mock/content.mock.service.js.map +0 -1
- package/src/lib/mock/data.mock.service.js.map +0 -1
- package/src/lib/mock/endpoint.mock.service.js.map +0 -1
- package/src/lib/mock/events.mock.service.js.map +0 -1
- package/src/lib/mock/flow-deployment.mock.service.js.map +0 -1
- package/src/lib/mock/flow-functions.mock.service.js.map +0 -1
- package/src/lib/mock/flow-modules.mock.service.js.map +0 -1
- package/src/lib/mock/flow.mock.service.js.map +0 -1
- package/src/lib/mock/index.js.map +0 -1
- package/src/lib/mock/label.mock.service.js.map +0 -1
- package/src/lib/mock/notification.mock.service.js.map +0 -1
- package/src/lib/mock/secret.mock.service.js.map +0 -1
- package/src/lib/mock/task.mock.service.js.map +0 -1
- package/src/lib/mock/timeseries.mock.service.js.map +0 -1
- package/src/lib/mock/trash.mock.service.js.map +0 -1
- package/src/lib/mock/user.mock.service.js.map +0 -1
- package/src/lib/mock/vault.mock.service.js.map +0 -1
- package/src/lib/notification.interface.js.map +0 -1
- package/src/lib/notification.service.js.map +0 -1
- package/src/lib/proxy.service.js.map +0 -1
- package/src/lib/resource.interface.js.map +0 -1
- package/src/lib/schema.interface.js.map +0 -1
- package/src/lib/secret.interface.js.map +0 -1
- package/src/lib/secret.service.js.map +0 -1
- package/src/lib/storage.interface.js.map +0 -1
- package/src/lib/task.interface.js.map +0 -1
- package/src/lib/task.service.js.map +0 -1
- package/src/lib/timeseries.interface.js.map +0 -1
- package/src/lib/timeseries.service.js.map +0 -1
- package/src/lib/token-set.js.map +0 -1
- package/src/lib/trash.service.js.map +0 -1
- package/src/lib/user-settings.interface.js.map +0 -1
- package/src/lib/user.service.js.map +0 -1
- package/src/lib/vault.interface.js.map +0 -1
- package/src/lib/vault.service.js.map +0 -1
package/src/lib/http.service.js
CHANGED
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return HttpClient;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
12
|
-
const _axios = /*#__PURE__*/ _interop_require_default._(require("axios"));
|
|
13
|
-
const _eventsource = require("eventsource");
|
|
14
|
-
const _jose = require("jose");
|
|
15
|
-
const _Queue = require("./Queue");
|
|
16
|
-
const _tokenset = require("./token-set");
|
|
17
|
-
let HttpClient = class HttpClient {
|
|
18
|
-
constructor(baseURL, authBaseURL, realm, clientId, clientSecret, tokenSubject){
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { EventSource } from 'eventsource';
|
|
3
|
+
import { CompactSign, decodeJwt } from 'jose';
|
|
4
|
+
import { Queue } from './Queue';
|
|
5
|
+
import { TokenSet } from './token-set';
|
|
6
|
+
export class HttpClient {
|
|
7
|
+
constructor(baseURL, authBaseURL, realm, clientId, clientSecret, tokenSubject) {
|
|
19
8
|
this.baseURL = baseURL;
|
|
20
9
|
this.authBaseURL = authBaseURL;
|
|
21
10
|
this.realm = realm;
|
|
@@ -24,30 +13,24 @@ let HttpClient = class HttpClient {
|
|
|
24
13
|
this.tokenSubject = tokenSubject;
|
|
25
14
|
this.discoveredIssuers = new Map();
|
|
26
15
|
this.eventSourcesMap = new Map();
|
|
27
|
-
this.getQueueStats = ()=>this.requestQueue?.getStats();
|
|
28
|
-
this.delete = (url, config)=>this.request('DELETE', url, config);
|
|
29
|
-
this.get = (url, config)=>this.request('GET', url, config);
|
|
30
|
-
this.post = (url, data, config)=>this.request('POST', url, config, data);
|
|
31
|
-
this.put = (url, data, config)=>this.request('PUT', url, config, data);
|
|
32
|
-
this.request = (method, url, config = {}, data)=>{
|
|
33
|
-
return this.requestQueue.add(()=>new Promise((resolve, reject)=>{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
method,
|
|
44
|
-
url,
|
|
45
|
-
data
|
|
46
|
-
});
|
|
47
|
-
}).then((response)=>resolve(response.data)).catch(reject);
|
|
48
|
-
}));
|
|
16
|
+
this.getQueueStats = () => this.requestQueue?.getStats();
|
|
17
|
+
this.delete = (url, config) => this.request('DELETE', url, config);
|
|
18
|
+
this.get = (url, config) => this.request('GET', url, config);
|
|
19
|
+
this.post = (url, data, config) => this.request('POST', url, config, data);
|
|
20
|
+
this.put = (url, data, config) => this.request('PUT', url, config, data);
|
|
21
|
+
this.request = (method, url, config = {}, data) => {
|
|
22
|
+
return this.requestQueue.add(() => new Promise((resolve, reject) => {
|
|
23
|
+
const tokenP = config.token ? Promise.resolve(config.token) : this.getAccessToken();
|
|
24
|
+
tokenP
|
|
25
|
+
.then((token) => {
|
|
26
|
+
const headers = { Authorization: `Bearer ${token}`, ...config.headers };
|
|
27
|
+
return this.axiosInstance.request({ ...config, headers, method, url, data });
|
|
28
|
+
})
|
|
29
|
+
.then((response) => resolve(response.data))
|
|
30
|
+
.catch(reject);
|
|
31
|
+
}));
|
|
49
32
|
};
|
|
50
|
-
this.getAccessToken = async (forceRefresh = false)=>{
|
|
33
|
+
this.getAccessToken = async (forceRefresh = false) => {
|
|
51
34
|
let accessToken;
|
|
52
35
|
if (forceRefresh || !this.tokenSet || this.tokenSet.isExpired()) {
|
|
53
36
|
if (this.tokenSet?.provided) {
|
|
@@ -55,7 +38,8 @@ let HttpClient = class HttpClient {
|
|
|
55
38
|
}
|
|
56
39
|
this.tokenSet = await this.requestAccessToken();
|
|
57
40
|
accessToken = this.tokenSet.accessToken;
|
|
58
|
-
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
59
43
|
accessToken = this.tokenSet.accessToken;
|
|
60
44
|
}
|
|
61
45
|
if (this.tokenSubject) {
|
|
@@ -63,47 +47,36 @@ let HttpClient = class HttpClient {
|
|
|
63
47
|
this.exchangedTokenSet = await this.exchangeAccessToken(accessToken);
|
|
64
48
|
}
|
|
65
49
|
return this.exchangedTokenSet.accessToken;
|
|
66
|
-
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
67
52
|
return accessToken;
|
|
68
53
|
}
|
|
69
54
|
};
|
|
70
|
-
this.axiosInstance =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
});
|
|
74
|
-
this.authAxiosInstance = _axios.default.create({
|
|
75
|
-
baseURL: authBaseURL || baseURL,
|
|
76
|
-
timeout: 10000
|
|
77
|
-
});
|
|
78
|
-
this.requestQueue = new _Queue.Queue({
|
|
79
|
-
concurrency: 1,
|
|
80
|
-
timeout: 70000,
|
|
81
|
-
throwOnTimeout: true
|
|
82
|
-
});
|
|
55
|
+
this.axiosInstance = axios.create({ baseURL, timeout: 60000 });
|
|
56
|
+
this.authAxiosInstance = axios.create({ baseURL: authBaseURL || baseURL, timeout: 10000 });
|
|
57
|
+
this.requestQueue = new Queue({ concurrency: 1, timeout: 70000, throwOnTimeout: true });
|
|
83
58
|
}
|
|
84
59
|
async addEventSource(url, listener, errorListener, options = {}) {
|
|
85
60
|
const id = generateUUID();
|
|
86
|
-
const errListener = errorListener
|
|
87
|
-
|
|
88
|
-
|
|
61
|
+
const errListener = errorListener
|
|
62
|
+
? errorListener
|
|
63
|
+
: (event) => {
|
|
64
|
+
throw new Error(JSON.stringify(event, null, 2));
|
|
65
|
+
};
|
|
89
66
|
const token = options.token ? options.token : await this.getAccessToken();
|
|
90
|
-
const es = new
|
|
91
|
-
fetch: (input, init)=>fetch(input, {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
67
|
+
const es = new EventSource(`${this.baseURL}${url}`, {
|
|
68
|
+
fetch: (input, init) => fetch(input, {
|
|
69
|
+
...init,
|
|
70
|
+
headers: {
|
|
71
|
+
...init.headers,
|
|
72
|
+
Authorization: 'Bearer ' + token,
|
|
73
|
+
},
|
|
74
|
+
}),
|
|
98
75
|
});
|
|
99
76
|
es.addEventListener('message', listener);
|
|
100
77
|
es.addEventListener('error', errListener);
|
|
101
78
|
// the listeners have to be saved otherwise they cannot be removed
|
|
102
|
-
this.eventSourcesMap.set(id, {
|
|
103
|
-
eventSource: es,
|
|
104
|
-
listener,
|
|
105
|
-
errListener
|
|
106
|
-
});
|
|
79
|
+
this.eventSourcesMap.set(id, { eventSource: es, listener, errListener });
|
|
107
80
|
return id;
|
|
108
81
|
}
|
|
109
82
|
destroyEventSource(id) {
|
|
@@ -118,12 +91,14 @@ let HttpClient = class HttpClient {
|
|
|
118
91
|
this.eventSourcesMap.delete(id);
|
|
119
92
|
}
|
|
120
93
|
destroyAllEventSources() {
|
|
121
|
-
for (const key of this.eventSourcesMap.keys()){
|
|
94
|
+
for (const key of this.eventSourcesMap.keys()) {
|
|
122
95
|
this.destroyEventSource(key);
|
|
123
96
|
}
|
|
124
97
|
}
|
|
125
98
|
validateIssuer(issuer) {
|
|
126
|
-
if (!issuer.issuer ||
|
|
99
|
+
if (!issuer.issuer ||
|
|
100
|
+
!issuer.grant_types_supported?.includes('client_credentials') ||
|
|
101
|
+
!issuer.token_endpoint_auth_methods_supported?.includes('client_secret_jwt')) {
|
|
127
102
|
throw new Error('Issuer does not support client_secret_jwt');
|
|
128
103
|
}
|
|
129
104
|
return issuer;
|
|
@@ -135,9 +110,7 @@ let HttpClient = class HttpClient {
|
|
|
135
110
|
const wellKnownUri = `${uri}/.well-known/openid-configuration`;
|
|
136
111
|
const issuerResponse = await this.authAxiosInstance.get(wellKnownUri, {
|
|
137
112
|
responseType: 'json',
|
|
138
|
-
headers: {
|
|
139
|
-
Accept: 'application/json'
|
|
140
|
-
}
|
|
113
|
+
headers: { Accept: 'application/json' },
|
|
141
114
|
});
|
|
142
115
|
const validIssuer = this.validateIssuer(issuerResponse.data);
|
|
143
116
|
this.discoveredIssuers.set(uri, validIssuer);
|
|
@@ -146,44 +119,38 @@ let HttpClient = class HttpClient {
|
|
|
146
119
|
async requestAccessToken(additionalOpts = {}) {
|
|
147
120
|
const issuer = await this.discoverIssuer(`${this.authBaseURL}/realms/${this.realm}`);
|
|
148
121
|
const timestamp = Date.now() / 1000;
|
|
149
|
-
const audience = [
|
|
150
|
-
...new Set([
|
|
151
|
-
issuer.issuer,
|
|
152
|
-
issuer.token_endpoint
|
|
153
|
-
].filter(Boolean))
|
|
154
|
-
];
|
|
122
|
+
const audience = [...new Set([issuer.issuer, issuer.token_endpoint].filter(Boolean))];
|
|
155
123
|
const assertionPayload = {
|
|
156
124
|
iat: timestamp,
|
|
157
125
|
exp: timestamp + 60,
|
|
158
126
|
jti: generateUUID(),
|
|
159
127
|
iss: this.clientId,
|
|
160
128
|
sub: this.clientId,
|
|
161
|
-
aud: audience
|
|
129
|
+
aud: audience,
|
|
162
130
|
};
|
|
163
131
|
const supportedAlgos = issuer.token_endpoint_auth_signing_alg_values_supported;
|
|
164
|
-
const alg = issuer.token_endpoint_auth_signing_alg ??
|
|
132
|
+
const alg = issuer.token_endpoint_auth_signing_alg ??
|
|
133
|
+
(Array.isArray(supportedAlgos) && supportedAlgos.find((signAlg) => /^HS(?:256|384|512)/.test(signAlg)));
|
|
165
134
|
if (!alg) {
|
|
166
135
|
throw new Error('Issuer has to support HS256, HS384 or HS512');
|
|
167
136
|
}
|
|
168
|
-
const assertion = await new
|
|
169
|
-
alg
|
|
170
|
-
|
|
137
|
+
const assertion = await new CompactSign(Buffer.from(JSON.stringify(assertionPayload)))
|
|
138
|
+
.setProtectedHeader({ alg })
|
|
139
|
+
.sign(new TextEncoder().encode(this.clientSecret));
|
|
171
140
|
const opts = {
|
|
172
141
|
client_id: this.clientId,
|
|
173
142
|
client_assertion: assertion,
|
|
174
143
|
client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
|
|
175
144
|
grant_type: 'client_credentials',
|
|
176
|
-
...additionalOpts
|
|
145
|
+
...additionalOpts,
|
|
177
146
|
};
|
|
178
147
|
const authResponse = await this.authAxiosInstance.post(issuer.token_endpoint, new URLSearchParams(opts).toString(), {
|
|
179
|
-
headers: {
|
|
180
|
-
Accept: 'application/json',
|
|
181
|
-
'Content-Type': 'application/x-www-form-urlencoded'
|
|
182
|
-
}
|
|
148
|
+
headers: { Accept: 'application/json', 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
183
149
|
});
|
|
184
150
|
if (authResponse?.data?.access_token && authResponse.data.expires_in) {
|
|
185
|
-
return new
|
|
186
|
-
}
|
|
151
|
+
return new TokenSet(authResponse.data.access_token, authResponse.data.expires_in);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
187
154
|
throw new Error('Invalid access token received');
|
|
188
155
|
}
|
|
189
156
|
}
|
|
@@ -196,24 +163,22 @@ let HttpClient = class HttpClient {
|
|
|
196
163
|
subject_token: accessToken,
|
|
197
164
|
audience: this.clientId,
|
|
198
165
|
requested_token_type: 'urn:ietf:params:oauth:token-type:access_token',
|
|
199
|
-
requested_subject: this.tokenSubject
|
|
166
|
+
requested_subject: this.tokenSubject,
|
|
200
167
|
};
|
|
201
168
|
return this.requestAccessToken(opts);
|
|
202
169
|
}
|
|
203
170
|
async provideExternalToken(token) {
|
|
204
171
|
const issuer = await this.discoverIssuer(`${this.authBaseURL}/realms/${this.realm}`);
|
|
205
|
-
const { iss: providedIssuer, exp } =
|
|
172
|
+
const { iss: providedIssuer, exp } = decodeJwt(token);
|
|
206
173
|
if (issuer.issuer !== providedIssuer) {
|
|
207
174
|
throw new Error(`Provided token is not issued by currently configured issuer. Provided token issued by ${providedIssuer}, but ${issuer.issuer} is configured.`);
|
|
208
175
|
}
|
|
209
|
-
this.tokenSet = new
|
|
176
|
+
this.tokenSet = new TokenSet(token, exp - Date.now() / 1000, true);
|
|
210
177
|
}
|
|
211
|
-
}
|
|
178
|
+
}
|
|
212
179
|
function generateUUID() {
|
|
213
180
|
if (typeof globalThis.crypto?.randomUUID === 'function') {
|
|
214
181
|
return globalThis.crypto.randomUUID();
|
|
215
182
|
}
|
|
216
183
|
throw new Error('randomUUID() not available in this environment. Please upgrade to Node 20+ or a modern browser.');
|
|
217
184
|
}
|
|
218
|
-
|
|
219
|
-
//# sourceMappingURL=http.service.js.map
|
package/src/lib/label.service.js
CHANGED
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "LabelService", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return LabelService;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _dataservice = require("./data.service");
|
|
12
|
-
let LabelService = class LabelService extends _dataservice.DataService {
|
|
13
|
-
constructor(httpClient){
|
|
1
|
+
import { DataService } from './data.service';
|
|
2
|
+
export class LabelService extends DataService {
|
|
3
|
+
constructor(httpClient) {
|
|
14
4
|
super(httpClient, '/labels');
|
|
15
5
|
}
|
|
16
6
|
addMany(dtos, options = {}) {
|
|
17
|
-
return Promise.all(dtos.map((dto)=>this.addOne(dto, options)));
|
|
7
|
+
return Promise.all(dtos.map((dto) => this.addOne(dto, options)));
|
|
18
8
|
}
|
|
19
9
|
getOneByName(name, options = {}) {
|
|
20
10
|
return this.httpClient.get(`${this.basePath}/name/${name}`, options);
|
|
@@ -22,6 +12,4 @@ let LabelService = class LabelService extends _dataservice.DataService {
|
|
|
22
12
|
count(options = {}) {
|
|
23
13
|
return this.httpClient.get(`${this.basePath}/count`, options);
|
|
24
14
|
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
//# sourceMappingURL=label.service.js.map
|
|
15
|
+
}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return APIBaseMock;
|
|
1
|
+
import { APIBase } from '../api-base';
|
|
2
|
+
export class APIBaseMock extends APIBase {
|
|
3
|
+
constructor(data = []) {
|
|
4
|
+
super(null, null);
|
|
5
|
+
this.data = data;
|
|
9
6
|
}
|
|
10
|
-
}
|
|
11
|
-
const _apibase = require("../api-base");
|
|
12
|
-
let APIBaseMock = class APIBaseMock extends _apibase.APIBase {
|
|
13
|
-
constructor(data = []){
|
|
14
|
-
super(null, null), this.data = data;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=api-base.mock.js.map
|
|
7
|
+
}
|
|
@@ -23,6 +23,7 @@ import { AssetTypesMockService } from './assetTypes.mock.service';
|
|
|
23
23
|
import { ContentMockService } from './content.mock.service';
|
|
24
24
|
import { EndpointMockService } from './endpoint.mock.service';
|
|
25
25
|
import { EventsMockService } from './events.mock.service';
|
|
26
|
+
import { HttpMockService } from './http.mock.service';
|
|
26
27
|
import { LabelMockService } from './label.mock.service';
|
|
27
28
|
import { NotificationMockService } from './notification.mock.service';
|
|
28
29
|
import { SecretMockService } from './secret.mock.service';
|
|
@@ -30,8 +31,29 @@ import { TaskMockService } from './task.mock.service';
|
|
|
30
31
|
import { TimeseriesMockService } from './timeseries.mock.service';
|
|
31
32
|
import { UserMockService } from './user.mock.service';
|
|
32
33
|
import { VaultMockService } from './vault.mock.service';
|
|
34
|
+
export interface MockAPIInitData {
|
|
35
|
+
assets?: AssetInit[];
|
|
36
|
+
assetRevisions?: AssetRevisionInit[];
|
|
37
|
+
contents?: ContentInit[];
|
|
38
|
+
endpoints?: EndpointInit[];
|
|
39
|
+
secrets?: SecretInit[];
|
|
40
|
+
timeSeries?: TimeSeriesInit[];
|
|
41
|
+
tasks?: TaskInit[];
|
|
42
|
+
events?: EventInit[];
|
|
43
|
+
users?: UserInit;
|
|
44
|
+
flows?: FlowInit[];
|
|
45
|
+
flowRevisions?: FlowRevisionInit[];
|
|
46
|
+
deployments?: FlowDeploymentInit[];
|
|
47
|
+
functions?: FlowFunctionInit[];
|
|
48
|
+
functionRevisions?: FlowFunctionRevisionInit[];
|
|
49
|
+
modules?: FlowModuleInit[];
|
|
50
|
+
diagrams?: FlowDiagramInit[];
|
|
51
|
+
labels?: LabelInit[];
|
|
52
|
+
vault?: VaultSecretInit[];
|
|
53
|
+
notifications?: NotificationInit[];
|
|
54
|
+
}
|
|
33
55
|
export declare class MockAPI implements API {
|
|
34
|
-
httpClient:
|
|
56
|
+
httpClient: HttpMockService;
|
|
35
57
|
assets: AssetMockService;
|
|
36
58
|
assetTypes: AssetTypesMockService;
|
|
37
59
|
contents: ContentMockService;
|
|
@@ -49,27 +71,7 @@ export declare class MockAPI implements API {
|
|
|
49
71
|
users: UserMockService;
|
|
50
72
|
vault: VaultMockService;
|
|
51
73
|
notifications: NotificationMockService;
|
|
52
|
-
constructor(initData:
|
|
53
|
-
assets?: AssetInit[];
|
|
54
|
-
assetRevisions?: AssetRevisionInit[];
|
|
55
|
-
contents?: ContentInit[];
|
|
56
|
-
endpoints?: EndpointInit[];
|
|
57
|
-
secrets?: SecretInit[];
|
|
58
|
-
timeSeries?: TimeSeriesInit[];
|
|
59
|
-
tasks?: TaskInit[];
|
|
60
|
-
events?: EventInit[];
|
|
61
|
-
users?: UserInit;
|
|
62
|
-
flows?: FlowInit[];
|
|
63
|
-
flowRevisions?: FlowRevisionInit[];
|
|
64
|
-
deployments?: FlowDeploymentInit[];
|
|
65
|
-
functions?: FlowFunctionInit[];
|
|
66
|
-
functionRevisions?: FlowFunctionRevisionInit[];
|
|
67
|
-
modules?: FlowModuleInit[];
|
|
68
|
-
diagrams?: FlowDiagramInit[];
|
|
69
|
-
labels?: LabelInit[];
|
|
70
|
-
vault?: VaultSecretInit[];
|
|
71
|
-
notifications?: NotificationInit[];
|
|
72
|
-
});
|
|
74
|
+
constructor(initData: MockAPIInitData);
|
|
73
75
|
}
|
|
74
76
|
export type Identity<T> = {
|
|
75
77
|
[P in keyof T]: T[P];
|