@hahnpro/hpc-api 6.0.0 → 2024.4.0-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.
Files changed (180) hide show
  1. package/CHANGELOG.md +383 -0
  2. package/README.md +11 -0
  3. package/package.json +10 -27
  4. package/src/index.d.ts +20 -0
  5. package/src/index.js +20 -0
  6. package/{dist → src/lib}/Queue.js +2 -7
  7. package/src/lib/api-base.js +6 -0
  8. package/src/lib/api.js +60 -0
  9. package/src/lib/asset.interface.js +1 -0
  10. package/{dist → src/lib}/asset.service.js +21 -17
  11. package/src/lib/assettypes.service.js +24 -0
  12. package/{dist → src/lib}/content.interface.js +2 -5
  13. package/src/lib/content.service.js +49 -0
  14. package/src/lib/data.interface.js +3 -0
  15. package/{dist → src/lib}/data.service.js +18 -11
  16. package/src/lib/endpoint.interface.js +1 -0
  17. package/{dist → src/lib}/endpoint.service.d.ts +2 -2
  18. package/{dist → src/lib}/endpoint.service.js +2 -6
  19. package/src/lib/events.interface.js +1 -0
  20. package/src/lib/events.service.js +9 -0
  21. package/src/lib/flow-deployment.interface.js +1 -0
  22. package/src/lib/flow-deployment.service.js +68 -0
  23. package/src/lib/flow-function.interface.js +1 -0
  24. package/{dist → src/lib}/flow-function.service.js +3 -6
  25. package/src/lib/flow-module.interface.js +1 -0
  26. package/{dist → src/lib}/flow-module.service.js +8 -7
  27. package/src/lib/flow.interface.js +1 -0
  28. package/{dist → src/lib}/flow.service.js +15 -20
  29. package/{dist → src/lib}/http.service.d.ts +1 -1
  30. package/src/lib/http.service.js +184 -0
  31. package/src/lib/label.interface.js +1 -0
  32. package/{dist → src/lib}/label.service.js +2 -6
  33. package/src/lib/mock/api-base.mock.js +7 -0
  34. package/src/lib/mock/api.mock.js +199 -0
  35. package/{dist → src/lib}/mock/asset.mock.service.js +30 -41
  36. package/{dist → src/lib}/mock/assetTypes.mock.service.js +19 -27
  37. package/{dist → src/lib}/mock/content.mock.service.js +21 -24
  38. package/src/lib/mock/data.mock.service.js +93 -0
  39. package/{dist → src/lib}/mock/endpoint.mock.service.js +2 -6
  40. package/src/lib/mock/events.mock.service.js +10 -0
  41. package/src/lib/mock/flow-deployment.mock.service.js +118 -0
  42. package/{dist → src/lib}/mock/flow-functions.mock.service.js +12 -21
  43. package/src/lib/mock/flow-modules.mock.service.js +20 -0
  44. package/src/lib/mock/flow.mock.service.js +81 -0
  45. package/src/lib/mock/index.js +11 -0
  46. package/src/lib/mock/label.mock.service.js +13 -0
  47. package/src/lib/mock/notification.mock.service.js +7 -0
  48. package/src/lib/mock/secret.mock.service.js +28 -0
  49. package/src/lib/mock/task.mock.service.js +32 -0
  50. package/{dist → src/lib}/mock/timeseries.mock.service.js +40 -49
  51. package/{dist → src/lib}/mock/trash.mock.service.js +8 -15
  52. package/src/lib/mock/user.mock.service.js +10 -0
  53. package/{dist → src/lib}/mock/vault.mock.service.js +2 -6
  54. package/src/lib/notification.interface.js +1 -0
  55. package/src/lib/notification.service.js +6 -0
  56. package/{dist → src/lib}/proxy.service.js +1 -5
  57. package/src/lib/resource.interface.js +1 -0
  58. package/src/lib/schema.interface.js +1 -0
  59. package/src/lib/secret.interface.js +1 -0
  60. package/src/lib/secret.service.js +15 -0
  61. package/src/lib/storage.interface.js +1 -0
  62. package/src/lib/task.interface.js +1 -0
  63. package/src/lib/task.service.js +19 -0
  64. package/src/lib/timeseries.interface.js +1 -0
  65. package/src/lib/timeseries.service.js +92 -0
  66. package/{dist → src/lib}/token-set.js +3 -7
  67. package/{dist → src/lib}/trash.service.js +2 -6
  68. package/src/lib/user-settings.interface.js +1 -0
  69. package/src/lib/user.service.js +26 -0
  70. package/src/lib/vault.interface.js +1 -0
  71. package/src/lib/vault.service.js +10 -0
  72. package/LICENSE +0 -21
  73. package/dist/api-base.js +0 -10
  74. package/dist/api.js +0 -62
  75. package/dist/asset.interface.js +0 -2
  76. package/dist/assettypes.service.js +0 -28
  77. package/dist/content.service.js +0 -50
  78. package/dist/data.interface.js +0 -6
  79. package/dist/endpoint.interface.js +0 -2
  80. package/dist/events.interface.js +0 -2
  81. package/dist/events.service.js +0 -13
  82. package/dist/flow-deployment.interface.js +0 -2
  83. package/dist/flow-deployment.service.js +0 -74
  84. package/dist/flow-function.interface.js +0 -2
  85. package/dist/flow-module.interface.js +0 -2
  86. package/dist/flow.interface.js +0 -2
  87. package/dist/http.service.js +0 -182
  88. package/dist/index.d.ts +0 -20
  89. package/dist/index.js +0 -23
  90. package/dist/label.interface.js +0 -2
  91. package/dist/mock/api-base.mock.js +0 -11
  92. package/dist/mock/api.mock.js +0 -128
  93. package/dist/mock/data.mock.service.js +0 -96
  94. package/dist/mock/events.mock.service.js +0 -14
  95. package/dist/mock/flow-deployment.mock.service.js +0 -142
  96. package/dist/mock/flow-modules.mock.service.js +0 -27
  97. package/dist/mock/flow.mock.service.js +0 -93
  98. package/dist/mock/index.js +0 -14
  99. package/dist/mock/label.mock.service.js +0 -17
  100. package/dist/mock/notification.mock.service.js +0 -11
  101. package/dist/mock/secret.mock.service.js +0 -31
  102. package/dist/mock/task.mock.service.js +0 -37
  103. package/dist/mock/user.mock.service.js +0 -14
  104. package/dist/notification.interface.js +0 -2
  105. package/dist/notification.service.js +0 -10
  106. package/dist/resource.interface.js +0 -2
  107. package/dist/schema.interface.js +0 -2
  108. package/dist/secret.interface.js +0 -2
  109. package/dist/secret.service.js +0 -19
  110. package/dist/storage.interface.js +0 -2
  111. package/dist/task.interface.js +0 -2
  112. package/dist/task.service.js +0 -22
  113. package/dist/timeseries.interface.js +0 -2
  114. package/dist/timeseries.service.js +0 -56
  115. package/dist/user-settings.interface.js +0 -2
  116. package/dist/user.service.js +0 -33
  117. package/dist/vault.interface.js +0 -2
  118. package/dist/vault.service.js +0 -14
  119. package/{dist → src/lib}/Queue.d.ts +0 -0
  120. package/{dist → src/lib}/api-base.d.ts +0 -0
  121. package/{dist → src/lib}/api.d.ts +6 -6
  122. package/{dist → src/lib}/asset.interface.d.ts +0 -0
  123. package/{dist → src/lib}/asset.service.d.ts +0 -0
  124. package/{dist → src/lib}/assettypes.service.d.ts +0 -0
  125. package/{dist → src/lib}/content.interface.d.ts +0 -0
  126. package/{dist → src/lib}/content.service.d.ts +1 -1
  127. package/{dist → src/lib}/data.interface.d.ts +0 -0
  128. package/{dist → src/lib}/data.service.d.ts +0 -0
  129. package/{dist → src/lib}/endpoint.interface.d.ts +0 -0
  130. package/{dist → src/lib}/events.interface.d.ts +0 -0
  131. package/{dist → src/lib}/events.service.d.ts +0 -0
  132. package/{dist → src/lib}/flow-deployment.interface.d.ts +1 -1
  133. package/{dist → src/lib}/flow-deployment.service.d.ts +0 -0
  134. package/{dist → src/lib}/flow-function.interface.d.ts +0 -0
  135. package/{dist → src/lib}/flow-function.service.d.ts +1 -1
  136. package/{dist → src/lib}/flow-module.interface.d.ts +0 -0
  137. package/{dist → src/lib}/flow-module.service.d.ts +1 -1
  138. package/{dist → src/lib}/flow.interface.d.ts +1 -1
  139. package/{dist → src/lib}/flow.service.d.ts +1 -1
  140. package/{dist → src/lib}/label.interface.d.ts +0 -0
  141. package/{dist → src/lib}/label.service.d.ts +0 -0
  142. package/{dist → src/lib}/mock/api-base.mock.d.ts +0 -0
  143. package/{dist → src/lib}/mock/api.mock.d.ts +18 -18
  144. package/{dist → src/lib}/mock/asset.mock.service.d.ts +1 -1
  145. package/{dist → src/lib}/mock/assetTypes.mock.service.d.ts +0 -0
  146. package/{dist → src/lib}/mock/content.mock.service.d.ts +1 -1
  147. package/{dist → src/lib}/mock/data.mock.service.d.ts +0 -0
  148. package/{dist → src/lib}/mock/endpoint.mock.service.d.ts +0 -0
  149. package/{dist → src/lib}/mock/events.mock.service.d.ts +0 -0
  150. package/{dist → src/lib}/mock/flow-deployment.mock.service.d.ts +2 -2
  151. package/{dist → src/lib}/mock/flow-functions.mock.service.d.ts +1 -1
  152. package/{dist → src/lib}/mock/flow-modules.mock.service.d.ts +2 -2
  153. package/{dist → src/lib}/mock/flow.mock.service.d.ts +1 -1
  154. package/{dist → src/lib}/mock/index.d.ts +0 -0
  155. package/{dist → src/lib}/mock/label.mock.service.d.ts +1 -1
  156. package/{dist → src/lib}/mock/notification.mock.service.d.ts +1 -1
  157. package/{dist → src/lib}/mock/secret.mock.service.d.ts +1 -1
  158. package/{dist → src/lib}/mock/task.mock.service.d.ts +0 -0
  159. package/{dist → src/lib}/mock/timeseries.mock.service.d.ts +0 -0
  160. package/{dist → src/lib}/mock/trash.mock.service.d.ts +1 -1
  161. package/{dist → src/lib}/mock/user.mock.service.d.ts +0 -0
  162. package/{dist → src/lib}/mock/vault.mock.service.d.ts +1 -1
  163. package/{dist → src/lib}/notification.interface.d.ts +0 -0
  164. package/{dist → src/lib}/notification.service.d.ts +1 -1
  165. package/{dist → src/lib}/proxy.service.d.ts +0 -0
  166. package/{dist → src/lib}/resource.interface.d.ts +0 -0
  167. package/{dist → src/lib}/schema.interface.d.ts +0 -0
  168. package/{dist → src/lib}/secret.interface.d.ts +0 -0
  169. package/{dist → src/lib}/secret.service.d.ts +0 -0
  170. package/{dist → src/lib}/storage.interface.d.ts +0 -0
  171. package/{dist → src/lib}/task.interface.d.ts +0 -0
  172. package/{dist → src/lib}/task.service.d.ts +0 -0
  173. package/{dist → src/lib}/timeseries.interface.d.ts +0 -0
  174. package/{dist → src/lib}/timeseries.service.d.ts +0 -0
  175. package/{dist → src/lib}/token-set.d.ts +0 -0
  176. package/{dist → src/lib}/trash.service.d.ts +0 -0
  177. package/{dist → src/lib}/user-settings.interface.d.ts +0 -0
  178. package/{dist → src/lib}/user.service.d.ts +0 -0
  179. package/{dist → src/lib}/vault.interface.d.ts +0 -0
  180. package/{dist → src/lib}/vault.service.d.ts +1 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,383 @@
1
+ # @hahnpro/hpc-api
2
+
3
+ ## [Unreleased]
4
+
5
+ ### Major Changes
6
+
7
+ - This package now follows a calendar versioning scheme and is tied to the HahnPRO Cloud version.
8
+
9
+ ## 6.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - df8453d: # Overview
14
+
15
+ Multiple ways of providing an authentication token have been added.
16
+
17
+ A token can be provided to the `HttpClient` by calling `provideExternalToken(...)`, this token will be used for API-Calls,
18
+ instead of getting a token directly using the User-Id and Secret.
19
+
20
+ Another option ist providing a token directly at an API-Call. For this, a new Option has been added to every API method.
21
+
22
+ ```typescript
23
+ await api.assets.getOne('someId', { token: 'TOKEN' });
24
+ ```
25
+
26
+ The third option is to overwrite the `getAccessToken()` method of the `HttpClient`.
27
+
28
+ The hierarchy of options is:
29
+
30
+ 1. token from api-call
31
+ 2. token from `provideExternalToken`
32
+ 3. token from `getAccessToken`
33
+
34
+ # Breaking Changes
35
+
36
+ 1. The signature of `flowDeployments::updateOne` has been changed. The positional parameter `force` is now part of the `options` object (where you can also provide a token as described above).
37
+
38
+ ## 5.3.4
39
+
40
+ ### Patch Changes
41
+
42
+ - d3e7ca1: Updated dependencies to reduce vulnerabilities
43
+
44
+ ## 5.3.3
45
+
46
+ ### Patch Changes
47
+
48
+ - ef6ee56: added missing asset-type-service init to Mock-API
49
+
50
+ ## 5.3.2
51
+
52
+ ### Patch Changes
53
+
54
+ - b783a01: Updated dependencies to reduce vulnerabilities
55
+
56
+ ## 5.3.1
57
+
58
+ ### Patch Changes
59
+
60
+ - 74b888f: Updated dependencies to reduce vulnerabilities
61
+
62
+ ## 5.3.0
63
+
64
+ ### Minor Changes
65
+
66
+ - 0ce38af: Allow Flow-Deployments to be run with owners permissions
67
+
68
+ ## 5.2.8
69
+
70
+ ### Patch Changes
71
+
72
+ - 4a1d52d: updated axios for vulnerability
73
+
74
+ ## 5.2.7
75
+
76
+ ### Patch Changes
77
+
78
+ - 713ccbd: Updated dependencies to reduce vulnerabilities
79
+
80
+ ## 5.2.6
81
+
82
+ ### Patch Changes
83
+
84
+ - 6c7abb2: Updated dependencies to reduce vulnerabilities
85
+
86
+ ## 5.2.5
87
+
88
+ ### Patch Changes
89
+
90
+ - a6eebf2: Updated dependencies to reduce vulnerabilities
91
+
92
+ ## 5.2.4
93
+
94
+ ### Patch Changes
95
+
96
+ - f93e4f9: Updated dependencies to reduce vulnerabilities
97
+
98
+ ## 5.2.3
99
+
100
+ ### Patch Changes
101
+
102
+ - 39b5f50: Updated dependencies to reduce vulnerabilities
103
+
104
+ ## 5.2.2
105
+
106
+ - Fixed getFilterString method for api services to filter out null and undefined values
107
+
108
+ ## 5.2.1
109
+
110
+ ### Patch Changes
111
+
112
+ - a431b4f: Added type check to getFilterString function
113
+
114
+ ## 5.2.0
115
+
116
+ ### Minor Changes
117
+
118
+ - e4a9f4d: Added addManyAssetTimeSeriesValues method to TimeSeries API service
119
+
120
+ ## 5.1.0
121
+
122
+ ### Minor Changes
123
+
124
+ - f0c4d8d: extend filters of getManyFiltered() + improve mock api
125
+
126
+ ## 5.0.0
127
+
128
+ ### Major Changes
129
+
130
+ - 19af51f: Updated dependencies to reduce vulnerabilities
131
+
132
+ **Breaking changes**
133
+
134
+ - Raise minimum Node.js version to v18 for hpc-api and flow-sdk packages
135
+
136
+ ## 4.1.2
137
+
138
+ ### Patch Changes
139
+
140
+ - f86bcac: Updated dependencies to reduce vulnerabilities
141
+
142
+ ## 4.1.1
143
+
144
+ ### Patch Changes
145
+
146
+ - eb65f7f: Fixed build target to make api-package compatible with tools that use older language versions (i.e. cypress)
147
+
148
+ ## 4.1.0
149
+
150
+ ### Minor Changes
151
+
152
+ - 621277d: add event level override functions to asset service
153
+
154
+ ## 4.0.2
155
+
156
+ ### Patch Changes
157
+
158
+ - cdcd295: add new property to notification service
159
+
160
+ ## 4.0.1
161
+
162
+ ### Patch Changes
163
+
164
+ - 92673bb: Updated dependencies to reduce vulnerabilities
165
+
166
+ ## 4.0.0
167
+
168
+ ### Major Changes
169
+
170
+ - a7ea37b: Removed deprecated API methods and properties
171
+
172
+ ### Minor Changes
173
+
174
+ - a7ea37b: Allow API HttpClient to be provided
175
+
176
+ ## 3.8.1
177
+
178
+ ### Patch Changes
179
+
180
+ - 75c87ab: fixed addition of timeseries values and events in mock api
181
+
182
+ ## 3.8.0
183
+
184
+ ### Minor Changes
185
+
186
+ - 6cd509a: Added notification endpoint to create and update notifications
187
+
188
+ ## 3.7.1
189
+
190
+ ### Patch Changes
191
+
192
+ - 1b1b2d0: Fixed auth token expiration check
193
+
194
+ ## 3.7.0
195
+
196
+ ### Minor Changes
197
+
198
+ - 7159fd4: Added API function to get Asset Attachments
199
+
200
+ ## 3.6.7
201
+
202
+ ### Patch Changes
203
+
204
+ - d6e655c: Updated dependencies to reduce vulnerabilities
205
+
206
+ ## 3.6.6
207
+
208
+ ### Patch Changes
209
+
210
+ - b53dd91: fix addition of timeseries values in mock api
211
+
212
+ ## 3.6.5
213
+
214
+ ### Patch Changes
215
+
216
+ - b5c2b74: Updated dependencies to reduce vulnerabilities
217
+
218
+ ## 3.6.4
219
+
220
+ ### Patch Changes
221
+
222
+ - f445b96: Fixes issue with http response encoding/transformation by downgrading axios
223
+
224
+ ## 3.6.3
225
+
226
+ ### Patch Changes
227
+
228
+ - 827a101: Updated dependencies to reduce vulnerabilities
229
+
230
+ ## 3.6.2
231
+
232
+ ### Patch Changes
233
+
234
+ - c40f5c5: updated dependencies to reduce vulnerabilities
235
+
236
+ ## 3.6.1
237
+
238
+ ### Patch Changes
239
+
240
+ - bcc1b60: Fixed bug where wrong endpoint was called when requesting flow diagram revisions. The flow revisions endpoint was called instead.
241
+
242
+ ## 3.6.0
243
+
244
+ ### Minor Changes
245
+
246
+ - 6a5ab51: fix vault base path
247
+
248
+ ## 3.5.0
249
+
250
+ ### Minor Changes
251
+
252
+ - f2b8d05: add vault endpoint to create and get secrets
253
+
254
+ ## 3.4.4
255
+
256
+ ### Patch Changes
257
+
258
+ - 29eb88e: changed over to uuid package for uuid generation. as crypto package is not usable in a cross-platform manner.
259
+
260
+ ## 3.4.3
261
+
262
+ ### Patch Changes
263
+
264
+ - 6ce20bb: Migrated form openid-client to custom auth implementation, to make the api package browser compatible
265
+
266
+ ## 3.4.2
267
+
268
+ ### Patch Changes
269
+
270
+ - fa3bf33: Fixes base path of authorization url for HPC API
271
+
272
+ ## 3.4.1
273
+
274
+ ### Patch Changes
275
+
276
+ - e5202b0: Added paused status to FlowDeploymentService::updateStatus
277
+
278
+ ## 3.4.0
279
+
280
+ ### Minor Changes
281
+
282
+ - 675a239: Use the more secure client_secret_jwt authentication method for authenticating service accounts against the HPC API
283
+
284
+ ## 3.3.0
285
+
286
+ ### Minor Changes
287
+
288
+ - 8bd0141: added trash endpoint for all supported resources
289
+
290
+ ## 3.2.1
291
+
292
+ ### Patch Changes
293
+
294
+ - e0868c0: added createdAt and updatedAt attributes to Event interface
295
+
296
+ ## 3.2.0
297
+
298
+ ### Minor Changes
299
+
300
+ - 966f2e2: added label service for communication with labels API
301
+
302
+ ## 3.1.0
303
+
304
+ ### Minor Changes
305
+
306
+ - d95c007: added function for interaction with asset-paperbin API
307
+
308
+ ## 3.0.0
309
+
310
+ ### Major Changes
311
+
312
+ - 2c6d6f9: added revision functionality for AM and FS
313
+ - added _getRevisions_, _rollback_ and _deleteRevision_ methods to the services of assets, assettypes, flow-functions and flows
314
+ - **BREAKING** renamed _findRevisions_ of asset service to _getRevisions_
315
+ - **BREAKING** renamed old _getRevisions_ method of flow service to _getDiagramRevisions_
316
+ - **BREAKING** removed _getOneWithHistory_ method of flow-function service and the history and current attributes of flow-functions (use _getRevisions_ instead)
317
+
318
+ ## 2.3.1
319
+
320
+ ### Patch Changes
321
+
322
+ - 3e3ee84: fixed from wrong date access function to valueof
323
+
324
+ ## 2.3.0
325
+
326
+ ### Minor Changes
327
+
328
+ - 1edd4da: Added function to flow-service to get flow revisions and function to check if a deployment is on the latest version
329
+
330
+ ## 2.2.0
331
+
332
+ ### Minor Changes
333
+
334
+ - eac4dea: Added functions for flow-service
335
+
336
+ ## 2.1.1
337
+
338
+ ### Patch Changes
339
+
340
+ - 8edcf1c: fixed breaking change in mock-api
341
+
342
+ ## 2.1.0
343
+
344
+ ### Minor Changes
345
+
346
+ - 5c2c1c6: feat: added findRevisions to the asset service
347
+
348
+ ## 2.0.0
349
+
350
+ ### Major Changes
351
+
352
+ - d16e8fc: Updated the interface types to reflect changes to the Assettypes in the HPC-API.
353
+
354
+ ## 1.1.0
355
+
356
+ ### Minor Changes
357
+
358
+ - 85cc9d7: add assetId and assetName to endpoint api and combine parameters to a single object
359
+
360
+ ## 1.0.3
361
+
362
+ ### Patch Changes
363
+
364
+ - dac742f: changed Mock-API init types to be dependent on real types
365
+
366
+ ## 1.0.2
367
+
368
+ ### Patch Changes
369
+
370
+ - Improve handling of API_BASE_URL and API_BASE_PATH environment variables
371
+
372
+ ## 1.0.1
373
+
374
+ ### Patch Changes
375
+
376
+ - 507dd6e: Added tags to Assettype interface
377
+ - ab04943: Add timeout for http request queue operations
378
+
379
+ ## 1.0.0
380
+
381
+ ### Major Changes
382
+
383
+ - 205b556: Split API from main SDK package to its own package.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # hpc-api
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build hpc-api` to build the library.
8
+
9
+ ## Running unit tests
10
+
11
+ Run `nx test hpc-api` to execute the unit tests via [Jest](https://jestjs.io).
package/package.json CHANGED
@@ -1,47 +1,30 @@
1
1
  {
2
2
  "name": "@hahnpro/hpc-api",
3
- "version": "6.0.0",
4
- "description": "Module for easy access to the HahnPRO API",
3
+ "version": "2024.4.0-1",
4
+ "description": "Module for easy access to the HahnPRO Cloud API",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "Hahn Projects GmbH",
8
8
  "url": "https://hahnpro.com"
9
9
  },
10
- "repository": {
11
- "type": "git",
12
- "url": "git@github.com:hahnprojects/flow.git"
13
- },
14
- "directories": {
15
- "lib": "lib",
16
- "test": "test"
17
- },
18
- "files": [
19
- "dist"
20
- ],
21
- "main": "./dist/index.js",
22
- "types": "./dist/index.d.ts",
23
- "publishConfig": {
24
- "access": "public"
25
- },
26
10
  "dependencies": {
27
11
  "axios": "1.7.9",
28
- "eventsource": "2.0.2",
12
+ "eventsource": "3.0.2",
29
13
  "form-data": "4.0.1",
30
14
  "jose": "5.9.6",
31
15
  "jwt-decode": "4.0.0",
32
- "p-queue": "6.6.2",
16
+ "p-queue": "8.1.0",
33
17
  "ts-mixer": "6.0.4",
34
- "uuid": "11.0.5"
18
+ "tslib": "2.8.1"
35
19
  },
36
20
  "devDependencies": {
37
- "@types/eventsource": "1.1.15",
38
21
  "axios-mock-adapter": "2.1.0"
39
22
  },
40
23
  "engines": {
41
- "node": ">=v18"
24
+ "node": ">=v20"
42
25
  },
43
- "scripts": {
44
- "build": "../../node_modules/.bin/tsc -p tsconfig.lib.json",
45
- "build:nocomments": "../../node_modules/.bin/tsc -p tsconfig.nocomments.json"
46
- }
26
+ "main": "./src/index.js",
27
+ "types": "./src/index.d.ts",
28
+ "module": "./src/index.js",
29
+ "type": "module"
47
30
  }
package/src/index.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ export * from './lib/api';
2
+ export * from './lib/asset.interface';
3
+ export * from './lib/content.interface';
4
+ export * from './lib/data.interface';
5
+ export * from './lib/data.service';
6
+ export * from './lib/endpoint.interface';
7
+ export * from './lib/events.interface';
8
+ export * from './lib/flow.interface';
9
+ export * from './lib/flow-deployment.interface';
10
+ export * from './lib/flow-function.interface';
11
+ export * from './lib/http.service';
12
+ export * from './lib/label.interface';
13
+ export * from './lib/mock';
14
+ export * from './lib/notification.interface';
15
+ export * from './lib/resource.interface';
16
+ export * from './lib/schema.interface';
17
+ export * from './lib/secret.interface';
18
+ export * from './lib/task.interface';
19
+ export * from './lib/timeseries.interface';
20
+ export * from './lib/vault.interface';
package/src/index.js ADDED
@@ -0,0 +1,20 @@
1
+ export * from './lib/api';
2
+ export * from './lib/asset.interface';
3
+ export * from './lib/content.interface';
4
+ export * from './lib/data.interface';
5
+ export * from './lib/data.service';
6
+ export * from './lib/endpoint.interface';
7
+ export * from './lib/events.interface';
8
+ export * from './lib/flow.interface';
9
+ export * from './lib/flow-deployment.interface';
10
+ export * from './lib/flow-function.interface';
11
+ export * from './lib/http.service';
12
+ export * from './lib/label.interface';
13
+ export * from './lib/mock';
14
+ export * from './lib/notification.interface';
15
+ export * from './lib/resource.interface';
16
+ export * from './lib/schema.interface';
17
+ export * from './lib/secret.interface';
18
+ export * from './lib/task.interface';
19
+ export * from './lib/timeseries.interface';
20
+ export * from './lib/vault.interface';
@@ -1,9 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Queue = void 0;
4
- const tslib_1 = require("tslib");
5
- const p_queue_1 = tslib_1.__importDefault(require("p-queue"));
6
- class Queue extends p_queue_1.default {
1
+ import PQueue from 'p-queue';
2
+ export class Queue extends PQueue {
7
3
  constructor(options) {
8
4
  super(options);
9
5
  this.peak = 0;
@@ -24,4 +20,3 @@ class Queue extends p_queue_1.default {
24
20
  };
25
21
  }
26
22
  }
27
- exports.Queue = Queue;
@@ -0,0 +1,6 @@
1
+ export class APIBase {
2
+ constructor(httpClient, basePath) {
3
+ this.httpClient = httpClient;
4
+ this.basePath = basePath;
5
+ }
6
+ }
package/src/lib/api.js ADDED
@@ -0,0 +1,60 @@
1
+ import { AssetService } from './asset.service';
2
+ import { AssetTypesService } from './assettypes.service';
3
+ import { ContentService } from './content.service';
4
+ import { EndpointService } from './endpoint.service';
5
+ import { EventsService } from './events.service';
6
+ import { FlowDeploymentService } from './flow-deployment.service';
7
+ import { FlowFunctionService } from './flow-function.service';
8
+ import { FlowModuleService } from './flow-module.service';
9
+ import { FlowService } from './flow.service';
10
+ import { HttpClient } from './http.service';
11
+ import { LabelService } from './label.service';
12
+ import { NotificationService } from './notification.service';
13
+ import { ProxyService } from './proxy.service';
14
+ import { SecretService } from './secret.service';
15
+ import { TaskService } from './task.service';
16
+ import { TimeSeriesService } from './timeseries.service';
17
+ import { UserService } from './user.service';
18
+ import { VaultService } from './vault.service';
19
+ export class API {
20
+ constructor(httpClient, context) {
21
+ this.httpClient = httpClient;
22
+ if (!httpClient) {
23
+ // remove leading and trailing slashes
24
+ const normalizePath = (value = '', defaultValue = '') => value.replace(/(?:^\/+)|(?:\/+$)/g, '') || defaultValue;
25
+ let apiBaseUrl = process.env.API_BASE_URL || 'https://testing.hahnpro.com';
26
+ if (!apiBaseUrl.startsWith('https') && !apiBaseUrl.startsWith('http')) {
27
+ /* eslint-disable-next-line no-console */
28
+ console.info('no protocol specified - using HTTPS');
29
+ apiBaseUrl = `https://${apiBaseUrl}`;
30
+ }
31
+ const apiUrl = apiBaseUrl + '/' + normalizePath(process.env.API_BASE_PATH, 'api');
32
+ const authBaseUrl = process.env.AUTH_BASE_URL || apiBaseUrl;
33
+ const authUrl = authBaseUrl + '/' + normalizePath(process.env.AUTH_BASE_PATH, 'auth');
34
+ const realm = process.env.AUTH_REALM || 'hpc';
35
+ const client = process.env.API_USER || 'flow-executor-service';
36
+ const secret = process.env.AUTH_SECRET;
37
+ if (!secret) {
38
+ throw new Error('"API_BASE_URL", "API_USER", "AUTH_REALM" and "AUTH_SECRET" environment variables must be set');
39
+ }
40
+ this.httpClient = new HttpClient(apiUrl, authUrl, realm, client, secret, context?.tokenSubject);
41
+ }
42
+ this.assets = new AssetService(this.httpClient);
43
+ this.assetTypes = new AssetTypesService(this.httpClient);
44
+ this.contents = new ContentService(this.httpClient);
45
+ this.endpoints = new EndpointService(this.httpClient);
46
+ this.events = new EventsService(this.httpClient);
47
+ this.flows = new FlowService(this.httpClient);
48
+ this.flowDeployments = new FlowDeploymentService(this.httpClient);
49
+ this.flowFunctions = new FlowFunctionService(this.httpClient);
50
+ this.flowModules = new FlowModuleService(this.httpClient);
51
+ this.labels = new LabelService(this.httpClient);
52
+ this.proxy = new ProxyService(this.httpClient);
53
+ this.secrets = new SecretService(this.httpClient);
54
+ this.tasks = new TaskService(this.httpClient);
55
+ this.timeSeries = new TimeSeriesService(this.httpClient);
56
+ this.users = new UserService(this.httpClient);
57
+ this.vault = new VaultService(this.httpClient);
58
+ this.notifications = new NotificationService(this.httpClient);
59
+ }
60
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,26 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AssetService = void 0;
4
- const tslib_1 = require("tslib");
5
- const ts_mixer_1 = require("ts-mixer");
6
- const api_base_1 = require("./api-base");
7
- const data_service_1 = require("./data.service");
8
- const trash_service_1 = require("./trash.service");
9
- let BaseService = class BaseService extends api_base_1.APIBase {
1
+ import { __decorate } from "tslib";
2
+ import { mix } from 'ts-mixer';
3
+ import { APIBase } from './api-base';
4
+ import { DataService } from './data.service';
5
+ import { TrashService } from './trash.service';
6
+ let BaseService = class BaseService extends APIBase {
10
7
  };
11
- BaseService = tslib_1.__decorate([
12
- (0, ts_mixer_1.mix)(data_service_1.DataService, trash_service_1.TrashService)
8
+ BaseService = __decorate([
9
+ mix(DataService, TrashService)
13
10
  ], BaseService);
14
- class AssetService extends BaseService {
11
+ export class AssetService extends BaseService {
15
12
  constructor(httpClient) {
16
13
  super(httpClient, '/assets');
17
14
  this.addAttachment = (id, form, options = {}) => {
18
- const headers = Object.assign({}, form.getHeaders());
19
- return this.httpClient.post(`${this.basePath}/${id}/attachment`, form, Object.assign({ headers, maxBodyLength: Infinity, maxContentLength: Infinity }, options));
15
+ const headers = { ...form.getHeaders() };
16
+ return this.httpClient.post(`${this.basePath}/${id}/attachment`, form, {
17
+ headers,
18
+ maxBodyLength: Infinity,
19
+ maxContentLength: Infinity,
20
+ ...options,
21
+ });
20
22
  };
21
23
  }
22
24
  deleteOne(id, force = false, options = {}) {
23
- return this.httpClient.delete(`${this.basePath}/${id}`, Object.assign({ params: { force } }, options));
25
+ return this.httpClient.delete(`${this.basePath}/${id}`, { params: { force }, ...options });
24
26
  }
25
27
  getChildren(assetId, params = {}, options = {}) {
26
28
  return this.getManyFiltered({ parent: assetId }, params, options);
@@ -29,7 +31,10 @@ class AssetService extends BaseService {
29
31
  return this.httpClient.get(`${this.basePath}/${assetId}/attachments`, options);
30
32
  }
31
33
  getEventLevelOverride(ids, causes, options = {}) {
32
- return this.httpClient.get(`${this.basePath}/eventcauses`, Object.assign({ params: { ids: ids.join(','), causes: causes.join(',') } }, options));
34
+ return this.httpClient.get(`${this.basePath}/eventcauses`, {
35
+ params: { ids: ids.join(','), causes: causes.join(',') },
36
+ ...options,
37
+ });
33
38
  }
34
39
  updateEventCausesAsset(id, dto, options = {}) {
35
40
  return this.httpClient.put(`${this.basePath}/${id}/eventcauses`, dto, options);
@@ -44,4 +49,3 @@ class AssetService extends BaseService {
44
49
  return this.httpClient.delete(`${this.basePath}/${assetId}/revisions/${revisionId}`, options);
45
50
  }
46
51
  }
47
- exports.AssetService = AssetService;
@@ -0,0 +1,24 @@
1
+ import { __decorate } from "tslib";
2
+ import { mix } from 'ts-mixer';
3
+ import { APIBase } from './api-base';
4
+ import { DataService } from './data.service';
5
+ import { TrashService } from './trash.service';
6
+ let BaseService = class BaseService extends APIBase {
7
+ };
8
+ BaseService = __decorate([
9
+ mix(DataService, TrashService)
10
+ ], BaseService);
11
+ export class AssetTypesService extends BaseService {
12
+ constructor(httpClient) {
13
+ super(httpClient, '/assettypes');
14
+ }
15
+ getRevisions(id, options = {}) {
16
+ return this.httpClient.get(`${this.basePath}/${id}/revisions`, options);
17
+ }
18
+ rollback(id, revisionId, options = {}) {
19
+ return this.httpClient.put(`${this.basePath}/${id}/rollback`, { revisionId }, options);
20
+ }
21
+ deleteRevision(id, revisionId, options = {}) {
22
+ return this.httpClient.delete(`${this.basePath}/${id}/revisions/${revisionId}`, options);
23
+ }
24
+ }
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ReturnType = void 0;
4
- var ReturnType;
1
+ export var ReturnType;
5
2
  (function (ReturnType) {
6
3
  ReturnType[ReturnType["TEXT"] = 0] = "TEXT";
7
4
  ReturnType[ReturnType["JSON"] = 1] = "JSON";
@@ -9,4 +6,4 @@ var ReturnType;
9
6
  ReturnType[ReturnType["BLOB"] = 3] = "BLOB";
10
7
  ReturnType[ReturnType["ARRAYBUFFER"] = 4] = "ARRAYBUFFER";
11
8
  ReturnType[ReturnType["NODESTREAM"] = 5] = "NODESTREAM";
12
- })(ReturnType || (exports.ReturnType = ReturnType = {}));
9
+ })(ReturnType || (ReturnType = {}));