@privateaim/core-http-kit 0.4.0

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.
Files changed (115) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +202 -0
  3. package/dist/client/index.d.ts +2 -0
  4. package/dist/client/index.d.ts.map +1 -0
  5. package/dist/client/module.d.ts +21 -0
  6. package/dist/client/module.d.ts.map +1 -0
  7. package/dist/domains/analysis/index.d.ts +2 -0
  8. package/dist/domains/analysis/index.d.ts.map +1 -0
  9. package/dist/domains/analysis/module.d.ts +20 -0
  10. package/dist/domains/analysis/module.d.ts.map +1 -0
  11. package/dist/domains/analysis-bucket/index.d.ts +2 -0
  12. package/dist/domains/analysis-bucket/index.d.ts.map +1 -0
  13. package/dist/domains/analysis-bucket/module.d.ts +9 -0
  14. package/dist/domains/analysis-bucket/module.d.ts.map +1 -0
  15. package/dist/domains/analysis-bucket-file/index.d.ts +2 -0
  16. package/dist/domains/analysis-bucket-file/index.d.ts.map +1 -0
  17. package/dist/domains/analysis-bucket-file/module.d.ts +12 -0
  18. package/dist/domains/analysis-bucket-file/module.d.ts.map +1 -0
  19. package/dist/domains/analysis-log/index.d.ts +2 -0
  20. package/dist/domains/analysis-log/index.d.ts.map +1 -0
  21. package/dist/domains/analysis-log/module.d.ts +12 -0
  22. package/dist/domains/analysis-log/module.d.ts.map +1 -0
  23. package/dist/domains/analysis-node/index.d.ts +2 -0
  24. package/dist/domains/analysis-node/index.d.ts.map +1 -0
  25. package/dist/domains/analysis-node/module.d.ts +12 -0
  26. package/dist/domains/analysis-node/module.d.ts.map +1 -0
  27. package/dist/domains/base.d.ts +8 -0
  28. package/dist/domains/base.d.ts.map +1 -0
  29. package/dist/domains/index.d.ts +14 -0
  30. package/dist/domains/index.d.ts.map +1 -0
  31. package/dist/domains/master-image/index.d.ts +2 -0
  32. package/dist/domains/master-image/index.d.ts.map +1 -0
  33. package/dist/domains/master-image/module.d.ts +11 -0
  34. package/dist/domains/master-image/module.d.ts.map +1 -0
  35. package/dist/domains/master-image-group/index.d.ts +2 -0
  36. package/dist/domains/master-image-group/index.d.ts.map +1 -0
  37. package/dist/domains/master-image-group/module.d.ts +9 -0
  38. package/dist/domains/master-image-group/module.d.ts.map +1 -0
  39. package/dist/domains/node/index.d.ts +2 -0
  40. package/dist/domains/node/index.d.ts.map +1 -0
  41. package/dist/domains/node/module.d.ts +13 -0
  42. package/dist/domains/node/module.d.ts.map +1 -0
  43. package/dist/domains/project/index.d.ts +2 -0
  44. package/dist/domains/project/index.d.ts.map +1 -0
  45. package/dist/domains/project/module.d.ts +12 -0
  46. package/dist/domains/project/module.d.ts.map +1 -0
  47. package/dist/domains/project-node/index.d.ts +2 -0
  48. package/dist/domains/project-node/index.d.ts.map +1 -0
  49. package/dist/domains/project-node/module.d.ts +12 -0
  50. package/dist/domains/project-node/module.d.ts.map +1 -0
  51. package/dist/domains/registry/index.d.ts +2 -0
  52. package/dist/domains/registry/index.d.ts.map +1 -0
  53. package/dist/domains/registry/module.d.ts +12 -0
  54. package/dist/domains/registry/module.d.ts.map +1 -0
  55. package/dist/domains/registry-project/index.d.ts +2 -0
  56. package/dist/domains/registry-project/index.d.ts.map +1 -0
  57. package/dist/domains/registry-project/module.d.ts +12 -0
  58. package/dist/domains/registry-project/module.d.ts.map +1 -0
  59. package/dist/domains/service/index.d.ts +2 -0
  60. package/dist/domains/service/index.d.ts.map +1 -0
  61. package/dist/domains/service/module.d.ts +12 -0
  62. package/dist/domains/service/module.d.ts.map +1 -0
  63. package/dist/domains/types-base.d.ts +29 -0
  64. package/dist/domains/types-base.d.ts.map +1 -0
  65. package/dist/index.cjs +1177 -0
  66. package/dist/index.cjs.map +1 -0
  67. package/dist/index.d.ts +3 -0
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.mjs +1163 -0
  70. package/dist/index.mjs.map +1 -0
  71. package/dist/utils/duplicate-slashes.d.ts +2 -0
  72. package/dist/utils/duplicate-slashes.d.ts.map +1 -0
  73. package/dist/utils/index.d.ts +3 -0
  74. package/dist/utils/index.d.ts.map +1 -0
  75. package/dist/utils/object-property.d.ts +4 -0
  76. package/dist/utils/object-property.d.ts.map +1 -0
  77. package/package.json +43 -0
  78. package/rollup.config.mjs +19 -0
  79. package/src/client/index.ts +8 -0
  80. package/src/client/module.ts +83 -0
  81. package/src/domains/analysis/index.ts +8 -0
  82. package/src/domains/analysis/module.ts +107 -0
  83. package/src/domains/analysis-bucket/index.ts +8 -0
  84. package/src/domains/analysis-bucket/module.ts +30 -0
  85. package/src/domains/analysis-bucket-file/index.ts +8 -0
  86. package/src/domains/analysis-bucket-file/module.ts +51 -0
  87. package/src/domains/analysis-log/index.ts +8 -0
  88. package/src/domains/analysis-log/module.ts +43 -0
  89. package/src/domains/analysis-node/index.ts +8 -0
  90. package/src/domains/analysis-node/module.ts +43 -0
  91. package/src/domains/base.ts +30 -0
  92. package/src/domains/index.ts +20 -0
  93. package/src/domains/master-image/index.ts +7 -0
  94. package/src/domains/master-image/module.ts +47 -0
  95. package/src/domains/master-image-group/index.ts +7 -0
  96. package/src/domains/master-image-group/module.ts +25 -0
  97. package/src/domains/node/index.ts +8 -0
  98. package/src/domains/node/module.ts +51 -0
  99. package/src/domains/project/index.ts +8 -0
  100. package/src/domains/project/module.ts +42 -0
  101. package/src/domains/project-node/index.ts +8 -0
  102. package/src/domains/project-node/module.ts +45 -0
  103. package/src/domains/registry/index.ts +8 -0
  104. package/src/domains/registry/module.ts +45 -0
  105. package/src/domains/registry-project/index.ts +8 -0
  106. package/src/domains/registry-project/module.ts +45 -0
  107. package/src/domains/service/index.ts +8 -0
  108. package/src/domains/service/module.ts +36 -0
  109. package/src/domains/types-base.ts +42 -0
  110. package/src/index.ts +9 -0
  111. package/src/utils/duplicate-slashes.ts +16 -0
  112. package/src/utils/index.ts +9 -0
  113. package/src/utils/object-property.ts +47 -0
  114. package/tsconfig.build.json +11 -0
  115. package/tsconfig.json +10 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,1163 @@
1
+ import { isClient, createClient, Client as Client$1, HookName, isClientError } from 'hapic';
2
+ import { buildQuery } from 'rapiq';
3
+ import '@authup/kit';
4
+ import { ServiceID } from '@privateaim/core';
5
+
6
+ /*
7
+ * Copyright (c) 2023-2024.
8
+ * Author Peter Placzek (tada5hi)
9
+ * For the full copyright and license information,
10
+ * view the LICENSE file that was distributed with this source code.
11
+ */ function _define_property$5(obj, key, value) {
12
+ if (key in obj) {
13
+ Object.defineProperty(obj, key, {
14
+ value: value,
15
+ enumerable: true,
16
+ configurable: true,
17
+ writable: true
18
+ });
19
+ } else {
20
+ obj[key] = value;
21
+ }
22
+ return obj;
23
+ }
24
+ class BaseAPI {
25
+ // -----------------------------------------------------------------------------------
26
+ setClient(input) {
27
+ this.client = isClient(input) ? input : createClient(input);
28
+ }
29
+ // -----------------------------------------------------------------------------------
30
+ constructor(context){
31
+ _define_property$5(this, "client", void 0);
32
+ context = context || {};
33
+ this.setClient(context.client);
34
+ }
35
+ }
36
+
37
+ /*
38
+ * Copyright (c) 2021-2024.
39
+ * Author Peter Placzek (tada5hi)
40
+ * For the full copyright and license information,
41
+ * view the LICENSE file that was distributed with this source code.
42
+ */ function asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, key, arg) {
43
+ try {
44
+ var info = gen[key](arg);
45
+ var value = info.value;
46
+ } catch (error) {
47
+ reject(error);
48
+ return;
49
+ }
50
+ if (info.done) {
51
+ resolve(value);
52
+ } else {
53
+ Promise.resolve(value).then(_next, _throw);
54
+ }
55
+ }
56
+ function _async_to_generator$c(fn) {
57
+ return function() {
58
+ var self = this, args = arguments;
59
+ return new Promise(function(resolve, reject) {
60
+ var gen = fn.apply(self, args);
61
+ function _next(value) {
62
+ asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, "next", value);
63
+ }
64
+ function _throw(err) {
65
+ asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, "throw", err);
66
+ }
67
+ _next(undefined);
68
+ });
69
+ };
70
+ }
71
+ class MasterImageGroupAPI extends BaseAPI {
72
+ getMany(data) {
73
+ var _this = this;
74
+ return _async_to_generator$c(function*() {
75
+ const response = yield _this.client.get(`master-image-groups${buildQuery(data)}`);
76
+ return response.data;
77
+ })();
78
+ }
79
+ getOne(id) {
80
+ var _this = this;
81
+ return _async_to_generator$c(function*() {
82
+ const response = yield _this.client.delete(`master-image-groups/${id}`);
83
+ return response.data;
84
+ })();
85
+ }
86
+ }
87
+
88
+ /*
89
+ * Copyright (c) 2021-2024.
90
+ * Author Peter Placzek (tada5hi)
91
+ * For the full copyright and license information,
92
+ * view the LICENSE file that was distributed with this source code.
93
+ */ function asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, key, arg) {
94
+ try {
95
+ var info = gen[key](arg);
96
+ var value = info.value;
97
+ } catch (error) {
98
+ reject(error);
99
+ return;
100
+ }
101
+ if (info.done) {
102
+ resolve(value);
103
+ } else {
104
+ Promise.resolve(value).then(_next, _throw);
105
+ }
106
+ }
107
+ function _async_to_generator$b(fn) {
108
+ return function() {
109
+ var self = this, args = arguments;
110
+ return new Promise(function(resolve, reject) {
111
+ var gen = fn.apply(self, args);
112
+ function _next(value) {
113
+ asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, "next", value);
114
+ }
115
+ function _throw(err) {
116
+ asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, "throw", err);
117
+ }
118
+ _next(undefined);
119
+ });
120
+ };
121
+ }
122
+ function _define_property$4(obj, key, value) {
123
+ if (key in obj) {
124
+ Object.defineProperty(obj, key, {
125
+ value: value,
126
+ enumerable: true,
127
+ configurable: true,
128
+ writable: true
129
+ });
130
+ } else {
131
+ obj[key] = value;
132
+ }
133
+ return obj;
134
+ }
135
+ function _object_spread$3(target) {
136
+ for(var i = 1; i < arguments.length; i++){
137
+ var source = arguments[i] != null ? arguments[i] : {};
138
+ var ownKeys = Object.keys(source);
139
+ if (typeof Object.getOwnPropertySymbols === "function") {
140
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
141
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
142
+ }));
143
+ }
144
+ ownKeys.forEach(function(key) {
145
+ _define_property$4(target, key, source[key]);
146
+ });
147
+ }
148
+ return target;
149
+ }
150
+ class MasterImageAPI extends BaseAPI {
151
+ getMany(data) {
152
+ var _this = this;
153
+ return _async_to_generator$b(function*() {
154
+ const response = yield _this.client.get(`master-images${buildQuery(data)}`);
155
+ return response.data;
156
+ })();
157
+ }
158
+ getOne(id, data) {
159
+ var _this = this;
160
+ return _async_to_generator$b(function*() {
161
+ const response = yield _this.client.get(`master-images/${id}${buildQuery(data)}`);
162
+ return response.data;
163
+ })();
164
+ }
165
+ delete(id) {
166
+ var _this = this;
167
+ return _async_to_generator$b(function*() {
168
+ const response = yield _this.client.delete(`master-images/${id}`);
169
+ return response.data;
170
+ })();
171
+ }
172
+ runCommand(command, data = {}) {
173
+ var _this = this;
174
+ return _async_to_generator$b(function*() {
175
+ const actionData = _object_spread$3({
176
+ command
177
+ }, data);
178
+ const { data: response } = yield _this.client.post('master-images/command', actionData);
179
+ return response;
180
+ })();
181
+ }
182
+ }
183
+
184
+ function nullifyEmptyObjectProperties(data) {
185
+ const keys = Object.keys(data);
186
+ for(let i = 0; i < keys.length; i++){
187
+ if (data[keys[i]] === '') {
188
+ data[keys[i]] = null;
189
+ }
190
+ }
191
+ return data;
192
+ }
193
+
194
+ /*
195
+ * Copyright (c) 2021-2024.
196
+ * Author Peter Placzek (tada5hi)
197
+ * For the full copyright and license information,
198
+ * view the LICENSE file that was distributed with this source code.
199
+ */ function asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, key, arg) {
200
+ try {
201
+ var info = gen[key](arg);
202
+ var value = info.value;
203
+ } catch (error) {
204
+ reject(error);
205
+ return;
206
+ }
207
+ if (info.done) {
208
+ resolve(value);
209
+ } else {
210
+ Promise.resolve(value).then(_next, _throw);
211
+ }
212
+ }
213
+ function _async_to_generator$a(fn) {
214
+ return function() {
215
+ var self = this, args = arguments;
216
+ return new Promise(function(resolve, reject) {
217
+ var gen = fn.apply(self, args);
218
+ function _next(value) {
219
+ asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "next", value);
220
+ }
221
+ function _throw(err) {
222
+ asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "throw", err);
223
+ }
224
+ _next(undefined);
225
+ });
226
+ };
227
+ }
228
+ class ProjectAPI extends BaseAPI {
229
+ getMany(record) {
230
+ var _this = this;
231
+ return _async_to_generator$a(function*() {
232
+ const response = yield _this.client.get(`projects${buildQuery(record)}`);
233
+ return response.data;
234
+ })();
235
+ }
236
+ getOne(id, requestRecord) {
237
+ var _this = this;
238
+ return _async_to_generator$a(function*() {
239
+ const response = yield _this.client.get(`projects/${id}${buildQuery(requestRecord)}`);
240
+ return response.data;
241
+ })();
242
+ }
243
+ create(data) {
244
+ var _this = this;
245
+ return _async_to_generator$a(function*() {
246
+ const response = yield _this.client.post('projects', nullifyEmptyObjectProperties(data));
247
+ return response.data;
248
+ })();
249
+ }
250
+ delete(id) {
251
+ var _this = this;
252
+ return _async_to_generator$a(function*() {
253
+ const response = yield _this.client.delete(`projects/${id}`);
254
+ return response.data;
255
+ })();
256
+ }
257
+ update(id, data) {
258
+ var _this = this;
259
+ return _async_to_generator$a(function*() {
260
+ const response = yield _this.client.post(`projects/${id}`, nullifyEmptyObjectProperties(data));
261
+ return response.data;
262
+ })();
263
+ }
264
+ }
265
+
266
+ /*
267
+ * Copyright (c) 2021-2024.
268
+ * Author Peter Placzek (tada5hi)
269
+ * For the full copyright and license information,
270
+ * view the LICENSE file that was distributed with this source code.
271
+ */ function asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, key, arg) {
272
+ try {
273
+ var info = gen[key](arg);
274
+ var value = info.value;
275
+ } catch (error) {
276
+ reject(error);
277
+ return;
278
+ }
279
+ if (info.done) {
280
+ resolve(value);
281
+ } else {
282
+ Promise.resolve(value).then(_next, _throw);
283
+ }
284
+ }
285
+ function _async_to_generator$9(fn) {
286
+ return function() {
287
+ var self = this, args = arguments;
288
+ return new Promise(function(resolve, reject) {
289
+ var gen = fn.apply(self, args);
290
+ function _next(value) {
291
+ asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, "next", value);
292
+ }
293
+ function _throw(err) {
294
+ asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, "throw", err);
295
+ }
296
+ _next(undefined);
297
+ });
298
+ };
299
+ }
300
+ class ProjectNodeAPI extends BaseAPI {
301
+ getMany(data) {
302
+ var _this = this;
303
+ return _async_to_generator$9(function*() {
304
+ const response = yield _this.client.get(`project-nodes${buildQuery(data)}`);
305
+ return response.data;
306
+ })();
307
+ }
308
+ getOne(id, data) {
309
+ var _this = this;
310
+ return _async_to_generator$9(function*() {
311
+ const response = yield _this.client.get(`project-nodes/${id}${buildQuery(data)}`);
312
+ return response.data;
313
+ })();
314
+ }
315
+ create(data) {
316
+ var _this = this;
317
+ return _async_to_generator$9(function*() {
318
+ const response = yield _this.client.post('project-nodes', data);
319
+ return response.data;
320
+ })();
321
+ }
322
+ update(id, data) {
323
+ var _this = this;
324
+ return _async_to_generator$9(function*() {
325
+ const response = yield _this.client.post(`project-nodes/${id}`, nullifyEmptyObjectProperties(data));
326
+ return response.data;
327
+ })();
328
+ }
329
+ delete(id) {
330
+ var _this = this;
331
+ return _async_to_generator$9(function*() {
332
+ const response = yield _this.client.delete(`project-nodes/${id}`);
333
+ return response.data;
334
+ })();
335
+ }
336
+ }
337
+
338
+ /*
339
+ * Copyright (c) 2021-2024.
340
+ * Author Peter Placzek (tada5hi)
341
+ * For the full copyright and license information,
342
+ * view the LICENSE file that was distributed with this source code.
343
+ */ function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
344
+ try {
345
+ var info = gen[key](arg);
346
+ var value = info.value;
347
+ } catch (error) {
348
+ reject(error);
349
+ return;
350
+ }
351
+ if (info.done) {
352
+ resolve(value);
353
+ } else {
354
+ Promise.resolve(value).then(_next, _throw);
355
+ }
356
+ }
357
+ function _async_to_generator$8(fn) {
358
+ return function() {
359
+ var self = this, args = arguments;
360
+ return new Promise(function(resolve, reject) {
361
+ var gen = fn.apply(self, args);
362
+ function _next(value) {
363
+ asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, "next", value);
364
+ }
365
+ function _throw(err) {
366
+ asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, "throw", err);
367
+ }
368
+ _next(undefined);
369
+ });
370
+ };
371
+ }
372
+ class RegistryAPI extends BaseAPI {
373
+ getMany(options) {
374
+ var _this = this;
375
+ return _async_to_generator$8(function*() {
376
+ const response = yield _this.client.get(`registries${buildQuery(options)}`);
377
+ return response.data;
378
+ })();
379
+ }
380
+ getOne(id, options) {
381
+ var _this = this;
382
+ return _async_to_generator$8(function*() {
383
+ const response = yield _this.client.get(`registries/${id}${buildQuery(options)}`);
384
+ return response.data;
385
+ })();
386
+ }
387
+ create(data) {
388
+ var _this = this;
389
+ return _async_to_generator$8(function*() {
390
+ const response = yield _this.client.post('registries', nullifyEmptyObjectProperties(data));
391
+ return response.data;
392
+ })();
393
+ }
394
+ update(id, data) {
395
+ var _this = this;
396
+ return _async_to_generator$8(function*() {
397
+ const response = yield _this.client.post(`registries/${id}`, nullifyEmptyObjectProperties(data));
398
+ return response.data;
399
+ })();
400
+ }
401
+ delete(id) {
402
+ var _this = this;
403
+ return _async_to_generator$8(function*() {
404
+ const response = yield _this.client.delete(`registries/${id}`);
405
+ return response.data;
406
+ })();
407
+ }
408
+ }
409
+
410
+ /*
411
+ * Copyright (c) 2021-2024.
412
+ * Author Peter Placzek (tada5hi)
413
+ * For the full copyright and license information,
414
+ * view the LICENSE file that was distributed with this source code.
415
+ */ function asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, key, arg) {
416
+ try {
417
+ var info = gen[key](arg);
418
+ var value = info.value;
419
+ } catch (error) {
420
+ reject(error);
421
+ return;
422
+ }
423
+ if (info.done) {
424
+ resolve(value);
425
+ } else {
426
+ Promise.resolve(value).then(_next, _throw);
427
+ }
428
+ }
429
+ function _async_to_generator$7(fn) {
430
+ return function() {
431
+ var self = this, args = arguments;
432
+ return new Promise(function(resolve, reject) {
433
+ var gen = fn.apply(self, args);
434
+ function _next(value) {
435
+ asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "next", value);
436
+ }
437
+ function _throw(err) {
438
+ asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "throw", err);
439
+ }
440
+ _next(undefined);
441
+ });
442
+ };
443
+ }
444
+ class RegistryProjectAPI extends BaseAPI {
445
+ getMany(options) {
446
+ var _this = this;
447
+ return _async_to_generator$7(function*() {
448
+ const response = yield _this.client.get(`registry-projects${buildQuery(options)}`);
449
+ return response.data;
450
+ })();
451
+ }
452
+ getOne(id, options) {
453
+ var _this = this;
454
+ return _async_to_generator$7(function*() {
455
+ const response = yield _this.client.get(`registry-projects/${id}${buildQuery(options)}`);
456
+ return response.data;
457
+ })();
458
+ }
459
+ create(data) {
460
+ var _this = this;
461
+ return _async_to_generator$7(function*() {
462
+ const response = yield _this.client.post('registry-projects', nullifyEmptyObjectProperties(data));
463
+ return response.data;
464
+ })();
465
+ }
466
+ update(id, data) {
467
+ var _this = this;
468
+ return _async_to_generator$7(function*() {
469
+ const response = yield _this.client.post(`registry-projects/${id}`, nullifyEmptyObjectProperties(data));
470
+ return response.data;
471
+ })();
472
+ }
473
+ delete(id) {
474
+ var _this = this;
475
+ return _async_to_generator$7(function*() {
476
+ const response = yield _this.client.delete(`registry-projects/${id}`);
477
+ return response.data;
478
+ })();
479
+ }
480
+ }
481
+
482
+ /*
483
+ * Copyright (c) 2021-2024.
484
+ * Author Peter Placzek (tada5hi)
485
+ * For the full copyright and license information,
486
+ * view the LICENSE file that was distributed with this source code.
487
+ */ function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
488
+ try {
489
+ var info = gen[key](arg);
490
+ var value = info.value;
491
+ } catch (error) {
492
+ reject(error);
493
+ return;
494
+ }
495
+ if (info.done) {
496
+ resolve(value);
497
+ } else {
498
+ Promise.resolve(value).then(_next, _throw);
499
+ }
500
+ }
501
+ function _async_to_generator$6(fn) {
502
+ return function() {
503
+ var self = this, args = arguments;
504
+ return new Promise(function(resolve, reject) {
505
+ var gen = fn.apply(self, args);
506
+ function _next(value) {
507
+ asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "next", value);
508
+ }
509
+ function _throw(err) {
510
+ asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "throw", err);
511
+ }
512
+ _next(undefined);
513
+ });
514
+ };
515
+ }
516
+ function _define_property$3(obj, key, value) {
517
+ if (key in obj) {
518
+ Object.defineProperty(obj, key, {
519
+ value: value,
520
+ enumerable: true,
521
+ configurable: true,
522
+ writable: true
523
+ });
524
+ } else {
525
+ obj[key] = value;
526
+ }
527
+ return obj;
528
+ }
529
+ function _object_spread$2(target) {
530
+ for(var i = 1; i < arguments.length; i++){
531
+ var source = arguments[i] != null ? arguments[i] : {};
532
+ var ownKeys = Object.keys(source);
533
+ if (typeof Object.getOwnPropertySymbols === "function") {
534
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
535
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
536
+ }));
537
+ }
538
+ ownKeys.forEach(function(key) {
539
+ _define_property$3(target, key, source[key]);
540
+ });
541
+ }
542
+ return target;
543
+ }
544
+ class NodeAPI extends BaseAPI {
545
+ getMany(options) {
546
+ var _this = this;
547
+ return _async_to_generator$6(function*() {
548
+ const response = yield _this.client.get(`nodes${buildQuery(options)}`);
549
+ return response.data;
550
+ })();
551
+ }
552
+ getOne(id, options) {
553
+ var _this = this;
554
+ return _async_to_generator$6(function*() {
555
+ const response = yield _this.client.get(`nodes/${id}${buildQuery(options)}`);
556
+ return response.data;
557
+ })();
558
+ }
559
+ create(data) {
560
+ var _this = this;
561
+ return _async_to_generator$6(function*() {
562
+ const response = yield _this.client.post('nodes', nullifyEmptyObjectProperties(data));
563
+ return response.data;
564
+ })();
565
+ }
566
+ update(id, data) {
567
+ var _this = this;
568
+ return _async_to_generator$6(function*() {
569
+ const response = yield _this.client.post(`nodes/${id}`, nullifyEmptyObjectProperties(data));
570
+ return response.data;
571
+ })();
572
+ }
573
+ delete(id) {
574
+ var _this = this;
575
+ return _async_to_generator$6(function*() {
576
+ const response = yield _this.client.delete(`nodes/${id}`);
577
+ return response.data;
578
+ })();
579
+ }
580
+ runCommand(id, task, data) {
581
+ var _this = this;
582
+ return _async_to_generator$6(function*() {
583
+ const response = yield _this.client.post(`nodes/${id}/task`, _object_spread$2({
584
+ task
585
+ }, data));
586
+ return response.data;
587
+ })();
588
+ }
589
+ }
590
+
591
+ /*
592
+ * Copyright (c) 2021-2024.
593
+ * Author Peter Placzek (tada5hi)
594
+ * For the full copyright and license information,
595
+ * view the LICENSE file that was distributed with this source code.
596
+ */ function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
597
+ try {
598
+ var info = gen[key](arg);
599
+ var value = info.value;
600
+ } catch (error) {
601
+ reject(error);
602
+ return;
603
+ }
604
+ if (info.done) {
605
+ resolve(value);
606
+ } else {
607
+ Promise.resolve(value).then(_next, _throw);
608
+ }
609
+ }
610
+ function _async_to_generator$5(fn) {
611
+ return function() {
612
+ var self = this, args = arguments;
613
+ return new Promise(function(resolve, reject) {
614
+ var gen = fn.apply(self, args);
615
+ function _next(value) {
616
+ asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "next", value);
617
+ }
618
+ function _throw(err) {
619
+ asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "throw", err);
620
+ }
621
+ _next(undefined);
622
+ });
623
+ };
624
+ }
625
+ function _define_property$2(obj, key, value) {
626
+ if (key in obj) {
627
+ Object.defineProperty(obj, key, {
628
+ value: value,
629
+ enumerable: true,
630
+ configurable: true,
631
+ writable: true
632
+ });
633
+ } else {
634
+ obj[key] = value;
635
+ }
636
+ return obj;
637
+ }
638
+ function _object_spread$1(target) {
639
+ for(var i = 1; i < arguments.length; i++){
640
+ var source = arguments[i] != null ? arguments[i] : {};
641
+ var ownKeys = Object.keys(source);
642
+ if (typeof Object.getOwnPropertySymbols === "function") {
643
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
644
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
645
+ }));
646
+ }
647
+ ownKeys.forEach(function(key) {
648
+ _define_property$2(target, key, source[key]);
649
+ });
650
+ }
651
+ return target;
652
+ }
653
+ class AnalysisAPI extends BaseAPI {
654
+ // todo: we properly don't need this anymore
655
+ getResultDownloadPath(id) {
656
+ return `analyses/${id}/result/download`;
657
+ }
658
+ getResultDownloadURL(id) {
659
+ return new URL(this.getResultDownloadPath(id), this.client.getBaseURL()).href;
660
+ }
661
+ getFilesDownloadPath(id) {
662
+ return `analyses/${id}/files/download`;
663
+ }
664
+ getFileDownloadURL(id) {
665
+ return new URL(this.getFilesDownloadPath(id), this.client.getBaseURL()).href;
666
+ }
667
+ getMany(options) {
668
+ var _this = this;
669
+ return _async_to_generator$5(function*() {
670
+ const { data: response } = yield _this.client.get(`analyses${buildQuery(options)}`);
671
+ return response;
672
+ })();
673
+ }
674
+ getOne(id, options, requestConfig) {
675
+ var _this = this;
676
+ return _async_to_generator$5(function*() {
677
+ const { data: response } = yield _this.client.get(`analyses/${id}${buildQuery(options)}`, requestConfig);
678
+ return response;
679
+ })();
680
+ }
681
+ delete(id) {
682
+ var _this = this;
683
+ return _async_to_generator$5(function*() {
684
+ const { data: response } = yield _this.client.delete(`analyses/${id}`);
685
+ return response;
686
+ })();
687
+ }
688
+ update(id, data) {
689
+ var _this = this;
690
+ return _async_to_generator$5(function*() {
691
+ const { data: response } = yield _this.client.post(`analyses/${id}`, nullifyEmptyObjectProperties(data));
692
+ return response;
693
+ })();
694
+ }
695
+ create(data) {
696
+ var _this = this;
697
+ return _async_to_generator$5(function*() {
698
+ const { data: response } = yield _this.client.post('analyses', nullifyEmptyObjectProperties(data));
699
+ return response;
700
+ })();
701
+ }
702
+ runCommand(id, command, data = {}) {
703
+ var _this = this;
704
+ return _async_to_generator$5(function*() {
705
+ const actionData = _object_spread$1({
706
+ command
707
+ }, data);
708
+ const { data: response } = yield _this.client.post(`analyses/${id}/command`, actionData);
709
+ return response;
710
+ })();
711
+ }
712
+ streamFiles(id) {
713
+ var _this = this;
714
+ return _async_to_generator$5(function*() {
715
+ const response = yield _this.client.get(_this.getFilesDownloadPath(id), {
716
+ responseType: 'stream'
717
+ });
718
+ return response.data;
719
+ })();
720
+ }
721
+ downloadResult(id) {
722
+ var _this = this;
723
+ return _async_to_generator$5(function*() {
724
+ const response = yield _this.client.get(_this.getResultDownloadPath(id), {
725
+ responseType: 'stream'
726
+ });
727
+ return response.data;
728
+ })();
729
+ }
730
+ }
731
+
732
+ /*
733
+ * Copyright (c) 2021-2024.
734
+ * Author Peter Placzek (tada5hi)
735
+ * For the full copyright and license information,
736
+ * view the LICENSE file that was distributed with this source code.
737
+ */ function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
738
+ try {
739
+ var info = gen[key](arg);
740
+ var value = info.value;
741
+ } catch (error) {
742
+ reject(error);
743
+ return;
744
+ }
745
+ if (info.done) {
746
+ resolve(value);
747
+ } else {
748
+ Promise.resolve(value).then(_next, _throw);
749
+ }
750
+ }
751
+ function _async_to_generator$4(fn) {
752
+ return function() {
753
+ var self = this, args = arguments;
754
+ return new Promise(function(resolve, reject) {
755
+ var gen = fn.apply(self, args);
756
+ function _next(value) {
757
+ asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "next", value);
758
+ }
759
+ function _throw(err) {
760
+ asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "throw", err);
761
+ }
762
+ _next(undefined);
763
+ });
764
+ };
765
+ }
766
+ class AnalysisFileAPI extends BaseAPI {
767
+ getMany(options) {
768
+ var _this = this;
769
+ return _async_to_generator$4(function*() {
770
+ const response = yield _this.client.get(`analysis-files${buildQuery(options)}`);
771
+ return response.data;
772
+ })();
773
+ }
774
+ getOne(id) {
775
+ var _this = this;
776
+ return _async_to_generator$4(function*() {
777
+ const response = yield _this.client.get(`analysis-files/${id}`);
778
+ return response.data;
779
+ })();
780
+ }
781
+ delete(id) {
782
+ var _this = this;
783
+ return _async_to_generator$4(function*() {
784
+ const response = yield _this.client.delete(`analysis-files/${id}`);
785
+ return response.data;
786
+ })();
787
+ }
788
+ update(id, data) {
789
+ var _this = this;
790
+ return _async_to_generator$4(function*() {
791
+ const { data: response } = yield _this.client.post(`analysis-files/${id}`, nullifyEmptyObjectProperties(data));
792
+ return response;
793
+ })();
794
+ }
795
+ create(data) {
796
+ var _this = this;
797
+ return _async_to_generator$4(function*() {
798
+ const { data: response } = yield _this.client.post('analysis-files', nullifyEmptyObjectProperties(data));
799
+ return response;
800
+ })();
801
+ }
802
+ }
803
+
804
+ /*
805
+ * Copyright (c) 2021-2024.
806
+ * Author Peter Placzek (tada5hi)
807
+ * For the full copyright and license information,
808
+ * view the LICENSE file that was distributed with this source code.
809
+ */ function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
810
+ try {
811
+ var info = gen[key](arg);
812
+ var value = info.value;
813
+ } catch (error) {
814
+ reject(error);
815
+ return;
816
+ }
817
+ if (info.done) {
818
+ resolve(value);
819
+ } else {
820
+ Promise.resolve(value).then(_next, _throw);
821
+ }
822
+ }
823
+ function _async_to_generator$3(fn) {
824
+ return function() {
825
+ var self = this, args = arguments;
826
+ return new Promise(function(resolve, reject) {
827
+ var gen = fn.apply(self, args);
828
+ function _next(value) {
829
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
830
+ }
831
+ function _throw(err) {
832
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
833
+ }
834
+ _next(undefined);
835
+ });
836
+ };
837
+ }
838
+ class AnalysisLogAPI extends BaseAPI {
839
+ getMany(options) {
840
+ var _this = this;
841
+ return _async_to_generator$3(function*() {
842
+ const { data: response } = yield _this.client.get(`analysis-logs${buildQuery(options)}`);
843
+ return response;
844
+ })();
845
+ }
846
+ getOne(id) {
847
+ var _this = this;
848
+ return _async_to_generator$3(function*() {
849
+ const { data: response } = yield _this.client.get(`analysis-logs/${id}`);
850
+ return response;
851
+ })();
852
+ }
853
+ delete(id) {
854
+ var _this = this;
855
+ return _async_to_generator$3(function*() {
856
+ const { data: response } = yield _this.client.delete(`analysis-logs/${id}`);
857
+ return response;
858
+ })();
859
+ }
860
+ update(id, data) {
861
+ var _this = this;
862
+ return _async_to_generator$3(function*() {
863
+ const { data: response } = yield _this.client.post(`analysis-logs/${id}`, data);
864
+ return response;
865
+ })();
866
+ }
867
+ create(data) {
868
+ var _this = this;
869
+ return _async_to_generator$3(function*() {
870
+ const { data: response } = yield _this.client.post('analysis-logs', data);
871
+ return response;
872
+ })();
873
+ }
874
+ }
875
+
876
+ /*
877
+ * Copyright (c) 2021-2024.
878
+ * Author Peter Placzek (tada5hi)
879
+ * For the full copyright and license information,
880
+ * view the LICENSE file that was distributed with this source code.
881
+ */ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
882
+ try {
883
+ var info = gen[key](arg);
884
+ var value = info.value;
885
+ } catch (error) {
886
+ reject(error);
887
+ return;
888
+ }
889
+ if (info.done) {
890
+ resolve(value);
891
+ } else {
892
+ Promise.resolve(value).then(_next, _throw);
893
+ }
894
+ }
895
+ function _async_to_generator$2(fn) {
896
+ return function() {
897
+ var self = this, args = arguments;
898
+ return new Promise(function(resolve, reject) {
899
+ var gen = fn.apply(self, args);
900
+ function _next(value) {
901
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
902
+ }
903
+ function _throw(err) {
904
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
905
+ }
906
+ _next(undefined);
907
+ });
908
+ };
909
+ }
910
+ class TrainStationAPI extends BaseAPI {
911
+ getMany(options) {
912
+ var _this = this;
913
+ return _async_to_generator$2(function*() {
914
+ const { data: response } = yield _this.client.get(`analysis-nodes${buildQuery(options)}`);
915
+ return response;
916
+ })();
917
+ }
918
+ getOne(id) {
919
+ var _this = this;
920
+ return _async_to_generator$2(function*() {
921
+ const { data: response } = yield _this.client.get(`analysis-nodes/${id}`);
922
+ return response;
923
+ })();
924
+ }
925
+ delete(id) {
926
+ var _this = this;
927
+ return _async_to_generator$2(function*() {
928
+ const { data: response } = yield _this.client.delete(`analysis-nodes/${id}`);
929
+ return response;
930
+ })();
931
+ }
932
+ update(id, data) {
933
+ var _this = this;
934
+ return _async_to_generator$2(function*() {
935
+ const { data: response } = yield _this.client.post(`analysis-nodes/${id}`, data);
936
+ return response;
937
+ })();
938
+ }
939
+ create(data) {
940
+ var _this = this;
941
+ return _async_to_generator$2(function*() {
942
+ const { data: response } = yield _this.client.post('analysis-nodes', data);
943
+ return response;
944
+ })();
945
+ }
946
+ }
947
+
948
+ /*
949
+ * Copyright (c) 2021-2024.
950
+ * Author Peter Placzek (tada5hi)
951
+ * For the full copyright and license information,
952
+ * view the LICENSE file that was distributed with this source code.
953
+ */ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
954
+ try {
955
+ var info = gen[key](arg);
956
+ var value = info.value;
957
+ } catch (error) {
958
+ reject(error);
959
+ return;
960
+ }
961
+ if (info.done) {
962
+ resolve(value);
963
+ } else {
964
+ Promise.resolve(value).then(_next, _throw);
965
+ }
966
+ }
967
+ function _async_to_generator$1(fn) {
968
+ return function() {
969
+ var self = this, args = arguments;
970
+ return new Promise(function(resolve, reject) {
971
+ var gen = fn.apply(self, args);
972
+ function _next(value) {
973
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
974
+ }
975
+ function _throw(err) {
976
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
977
+ }
978
+ _next(undefined);
979
+ });
980
+ };
981
+ }
982
+ function _define_property$1(obj, key, value) {
983
+ if (key in obj) {
984
+ Object.defineProperty(obj, key, {
985
+ value: value,
986
+ enumerable: true,
987
+ configurable: true,
988
+ writable: true
989
+ });
990
+ } else {
991
+ obj[key] = value;
992
+ }
993
+ return obj;
994
+ }
995
+ function _object_spread(target) {
996
+ for(var i = 1; i < arguments.length; i++){
997
+ var source = arguments[i] != null ? arguments[i] : {};
998
+ var ownKeys = Object.keys(source);
999
+ if (typeof Object.getOwnPropertySymbols === "function") {
1000
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1001
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1002
+ }));
1003
+ }
1004
+ ownKeys.forEach(function(key) {
1005
+ _define_property$1(target, key, source[key]);
1006
+ });
1007
+ }
1008
+ return target;
1009
+ }
1010
+ class ServiceAPI extends BaseAPI {
1011
+ runCommand(id, command, data) {
1012
+ var _this = this;
1013
+ return _async_to_generator$1(function*() {
1014
+ data = data || {};
1015
+ const { data: resultData } = yield _this.client.post(`services/${id}/command`, nullifyEmptyObjectProperties(_object_spread({
1016
+ command
1017
+ }, data)));
1018
+ return resultData;
1019
+ })();
1020
+ }
1021
+ runRegistryCommand(command, data) {
1022
+ var _this = this;
1023
+ return _async_to_generator$1(function*() {
1024
+ return _this.runCommand(ServiceID.REGISTRY, command, data);
1025
+ })();
1026
+ }
1027
+ }
1028
+
1029
+ /*
1030
+ * Copyright (c) 2021-2024.
1031
+ * Author Peter Placzek (tada5hi)
1032
+ * For the full copyright and license information,
1033
+ * view the LICENSE file that was distributed with this source code.
1034
+ */ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1035
+ try {
1036
+ var info = gen[key](arg);
1037
+ var value = info.value;
1038
+ } catch (error) {
1039
+ reject(error);
1040
+ return;
1041
+ }
1042
+ if (info.done) {
1043
+ resolve(value);
1044
+ } else {
1045
+ Promise.resolve(value).then(_next, _throw);
1046
+ }
1047
+ }
1048
+ function _async_to_generator(fn) {
1049
+ return function() {
1050
+ var self = this, args = arguments;
1051
+ return new Promise(function(resolve, reject) {
1052
+ var gen = fn.apply(self, args);
1053
+ function _next(value) {
1054
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1055
+ }
1056
+ function _throw(err) {
1057
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1058
+ }
1059
+ _next(undefined);
1060
+ });
1061
+ };
1062
+ }
1063
+ class AnalysisBucketAPI extends BaseAPI {
1064
+ getMany(options) {
1065
+ var _this = this;
1066
+ return _async_to_generator(function*() {
1067
+ const response = yield _this.client.get(`analysis-buckets${buildQuery(options)}`);
1068
+ return response.data;
1069
+ })();
1070
+ }
1071
+ getOne(id) {
1072
+ var _this = this;
1073
+ return _async_to_generator(function*() {
1074
+ const response = yield _this.client.get(`analysis-buckets/${id}`);
1075
+ return response.data;
1076
+ })();
1077
+ }
1078
+ }
1079
+
1080
+ /*
1081
+ * Copyright (c) 2022-2024.
1082
+ * Author Peter Placzek (tada5hi)
1083
+ * For the full copyright and license information,
1084
+ * view the LICENSE file that was distributed with this source code.
1085
+ */ function _define_property(obj, key, value) {
1086
+ if (key in obj) {
1087
+ Object.defineProperty(obj, key, {
1088
+ value: value,
1089
+ enumerable: true,
1090
+ configurable: true,
1091
+ writable: true
1092
+ });
1093
+ } else {
1094
+ obj[key] = value;
1095
+ }
1096
+ return obj;
1097
+ }
1098
+ class Client extends Client$1 {
1099
+ constructor(config){
1100
+ super(config);
1101
+ _define_property(this, "masterImage", void 0);
1102
+ _define_property(this, "masterImageGroup", void 0);
1103
+ _define_property(this, "project", void 0);
1104
+ _define_property(this, "projectNode", void 0);
1105
+ _define_property(this, "registry", void 0);
1106
+ _define_property(this, "registryProject", void 0);
1107
+ _define_property(this, "node", void 0);
1108
+ _define_property(this, "analysis", void 0);
1109
+ _define_property(this, "analysisBucket", void 0);
1110
+ _define_property(this, "analysisBucketFile", void 0);
1111
+ _define_property(this, "analysisLog", void 0);
1112
+ _define_property(this, "analysisNode", void 0);
1113
+ _define_property(this, "service", void 0);
1114
+ this.masterImage = new MasterImageAPI({
1115
+ client: this
1116
+ });
1117
+ this.masterImageGroup = new MasterImageGroupAPI({
1118
+ client: this
1119
+ });
1120
+ this.project = new ProjectAPI({
1121
+ client: this
1122
+ });
1123
+ this.projectNode = new ProjectNodeAPI({
1124
+ client: this
1125
+ });
1126
+ this.registry = new RegistryAPI({
1127
+ client: this
1128
+ });
1129
+ this.registryProject = new RegistryProjectAPI({
1130
+ client: this
1131
+ });
1132
+ this.node = new NodeAPI({
1133
+ client: this
1134
+ });
1135
+ this.analysis = new AnalysisAPI({
1136
+ client: this
1137
+ });
1138
+ this.analysisBucket = new AnalysisBucketAPI({
1139
+ client: this
1140
+ });
1141
+ this.analysisBucketFile = new AnalysisFileAPI({
1142
+ client: this
1143
+ });
1144
+ this.analysisLog = new AnalysisLogAPI({
1145
+ client: this
1146
+ });
1147
+ this.analysisNode = new TrainStationAPI({
1148
+ client: this
1149
+ });
1150
+ this.service = new ServiceAPI({
1151
+ client: this
1152
+ });
1153
+ this.on(HookName.RESPONSE_ERROR, (error)=>{
1154
+ if (isClientError(error) && error.response && error.response.data && typeof error.response.data.message === 'string') {
1155
+ error.message = error.response.data.message;
1156
+ }
1157
+ throw error;
1158
+ });
1159
+ }
1160
+ }
1161
+
1162
+ export { AnalysisAPI, AnalysisFileAPI, AnalysisLogAPI, Client, MasterImageAPI, MasterImageGroupAPI, NodeAPI, ProjectAPI, ProjectNodeAPI, RegistryAPI, RegistryProjectAPI, ServiceAPI, TrainStationAPI };
1163
+ //# sourceMappingURL=index.mjs.map