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