@planqk/planqk-service-sdk 1.9.1 → 2.1.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 (221) hide show
  1. package/.devcontainer/devcontainer.json +32 -0
  2. package/.devcontainer/post-create.sh +7 -0
  3. package/.env.template +4 -0
  4. package/.gitlab-ci.yml +103 -0
  5. package/.python-version +1 -0
  6. package/.releaserc.json +45 -0
  7. package/LICENSE +201 -0
  8. package/README-node.md +41 -0
  9. package/README-python.md +52 -0
  10. package/README.md +42 -21
  11. package/dist/auth.js +12 -19
  12. package/dist/client.d.ts +2 -12
  13. package/dist/client.js +5 -76
  14. package/dist/sdk/Client.d.ts +4 -3
  15. package/dist/sdk/Client.js +4 -8
  16. package/dist/sdk/api/errors/BadRequestError.d.ts +1 -1
  17. package/dist/sdk/api/errors/BadRequestError.js +18 -8
  18. package/dist/sdk/api/errors/ForbiddenError.d.ts +1 -1
  19. package/dist/sdk/api/errors/ForbiddenError.js +18 -8
  20. package/dist/sdk/api/errors/InternalServerError.d.ts +1 -1
  21. package/dist/sdk/api/errors/InternalServerError.js +18 -8
  22. package/dist/sdk/api/errors/NotFoundError.d.ts +1 -1
  23. package/dist/sdk/api/errors/NotFoundError.js +18 -8
  24. package/dist/sdk/api/errors/UnauthorizedError.d.ts +1 -1
  25. package/dist/sdk/api/errors/UnauthorizedError.js +18 -8
  26. package/dist/sdk/api/resources/index.d.ts +0 -3
  27. package/dist/sdk/api/resources/index.js +18 -11
  28. package/dist/sdk/api/resources/serviceApi/client/Client.d.ts +65 -12
  29. package/dist/sdk/api/resources/serviceApi/client/Client.js +405 -261
  30. package/dist/sdk/api/resources/serviceApi/client/index.d.ts +1 -1
  31. package/dist/sdk/api/resources/serviceApi/client/index.js +0 -15
  32. package/dist/sdk/api/resources/serviceApi/types/GetResultResponse.d.ts +4 -1
  33. package/dist/sdk/api/resources/serviceApi/types/{GetInterimResultsResponse.d.ts → GetResultResponseEmbedded.d.ts} +3 -1
  34. package/dist/sdk/api/resources/serviceApi/types/GetResultResponseLinks.d.ts +7 -0
  35. package/dist/sdk/api/resources/{statusApi → serviceApi}/types/HealthCheckResponse.d.ts +1 -0
  36. package/dist/sdk/api/resources/serviceApi/types/index.d.ts +3 -1
  37. package/dist/sdk/api/resources/serviceApi/types/index.js +3 -1
  38. package/dist/sdk/api/types/HalLink.d.ts +21 -0
  39. package/dist/sdk/api/types/InputData.d.ts +1 -1
  40. package/dist/sdk/api/types/{InputRef.d.ts → InputDataRef.d.ts} +1 -1
  41. package/dist/sdk/api/types/InputParams.d.ts +1 -1
  42. package/dist/sdk/api/types/{Job.d.ts → ServiceExecution.d.ts} +2 -2
  43. package/dist/sdk/api/types/{JobStatus.d.ts → ServiceExecutionStatus.d.ts} +2 -2
  44. package/dist/sdk/api/types/{JobStatus.js → ServiceExecutionStatus.js} +2 -2
  45. package/dist/sdk/api/types/index.d.ts +4 -8
  46. package/dist/sdk/api/types/index.js +4 -8
  47. package/dist/sdk/core/fetcher/APIResponse.d.ts +1 -0
  48. package/dist/sdk/core/fetcher/Fetcher.d.ts +6 -5
  49. package/dist/sdk/core/fetcher/Fetcher.js +68 -112
  50. package/dist/sdk/core/fetcher/Supplier.js +2 -11
  51. package/dist/sdk/core/fetcher/createRequestUrl.d.ts +1 -0
  52. package/dist/sdk/core/fetcher/createRequestUrl.js +12 -0
  53. package/dist/sdk/core/fetcher/getFetchFn.d.ts +4 -0
  54. package/dist/sdk/core/fetcher/getFetchFn.js +57 -0
  55. package/dist/sdk/core/fetcher/getHeader.d.ts +1 -0
  56. package/dist/sdk/core/fetcher/getHeader.js +11 -0
  57. package/dist/sdk/core/fetcher/getRequestBody.d.ts +7 -0
  58. package/dist/sdk/core/fetcher/getRequestBody.js +11 -0
  59. package/dist/sdk/core/fetcher/getResponseBody.d.ts +1 -0
  60. package/dist/sdk/core/fetcher/getResponseBody.js +40 -0
  61. package/dist/sdk/core/fetcher/index.d.ts +1 -0
  62. package/dist/sdk/core/fetcher/index.js +3 -1
  63. package/dist/sdk/core/fetcher/makeRequest.d.ts +1 -0
  64. package/dist/sdk/core/fetcher/makeRequest.js +33 -0
  65. package/dist/sdk/core/fetcher/requestWithRetries.d.ts +1 -0
  66. package/dist/sdk/core/fetcher/requestWithRetries.js +20 -0
  67. package/dist/sdk/core/fetcher/signals.d.ts +11 -0
  68. package/dist/sdk/core/fetcher/signals.js +36 -0
  69. package/dist/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  70. package/dist/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +232 -0
  71. package/dist/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  72. package/dist/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +91 -0
  73. package/dist/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  74. package/dist/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +214 -0
  75. package/dist/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  76. package/dist/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.js +48 -0
  77. package/dist/sdk/core/index.d.ts +1 -0
  78. package/dist/sdk/core/index.js +1 -0
  79. package/dist/sdk/core/runtime/index.d.ts +1 -0
  80. package/dist/sdk/core/runtime/index.js +5 -0
  81. package/dist/sdk/core/runtime/runtime.d.ts +9 -0
  82. package/dist/sdk/core/runtime/runtime.js +92 -0
  83. package/dist/sdk/errors/PlanqkServiceApiError.js +2 -0
  84. package/dist/sdk/index.js +17 -7
  85. package/eslint.config.mjs +11 -0
  86. package/fern/fern.config.json +4 -0
  87. package/fern/generators.yml +25 -0
  88. package/fern/openapi/openapi.yml +342 -0
  89. package/notebooks/python-sdk.ipynb +280 -0
  90. package/package.json +27 -28
  91. package/planqk/__init__.py +0 -0
  92. package/planqk/service/__init__.py +1 -0
  93. package/planqk/service/_version.py +1 -0
  94. package/planqk/service/auth.py +30 -0
  95. package/planqk/service/client.py +151 -0
  96. package/planqk/service/sdk/__init__.py +48 -0
  97. package/planqk/service/sdk/client.py +152 -0
  98. package/planqk/service/sdk/core/__init__.py +47 -0
  99. package/planqk/service/sdk/core/api_error.py +17 -0
  100. package/planqk/service/sdk/core/client_wrapper.py +74 -0
  101. package/planqk/service/sdk/core/datetime_utils.py +30 -0
  102. package/planqk/service/sdk/core/file.py +70 -0
  103. package/planqk/service/sdk/core/http_client.py +575 -0
  104. package/planqk/service/sdk/core/jsonable_encoder.py +103 -0
  105. package/planqk/service/sdk/core/pydantic_utilities.py +323 -0
  106. package/planqk/service/sdk/core/query_encoder.py +60 -0
  107. package/planqk/service/sdk/core/remove_none_from_dict.py +11 -0
  108. package/planqk/service/sdk/core/request_options.py +35 -0
  109. package/planqk/service/sdk/core/serialization.py +276 -0
  110. package/planqk/service/sdk/environment.py +7 -0
  111. package/planqk/service/sdk/errors/__init__.py +15 -0
  112. package/planqk/service/sdk/errors/bad_request_error.py +9 -0
  113. package/planqk/service/sdk/errors/forbidden_error.py +9 -0
  114. package/planqk/service/sdk/errors/internal_server_error.py +9 -0
  115. package/planqk/service/sdk/errors/not_found_error.py +9 -0
  116. package/planqk/service/sdk/errors/unauthorized_error.py +9 -0
  117. package/planqk/service/sdk/service_api/__init__.py +15 -0
  118. package/planqk/service/sdk/service_api/client.py +1257 -0
  119. package/planqk/service/sdk/service_api/types/__init__.py +13 -0
  120. package/planqk/service/sdk/service_api/types/get_result_response.py +30 -0
  121. package/planqk/service/sdk/service_api/types/get_result_response_embedded.py +22 -0
  122. package/planqk/service/sdk/service_api/types/get_result_response_links.py +22 -0
  123. package/planqk/service/sdk/service_api/types/health_check_response.py +24 -0
  124. package/planqk/service/sdk/types/__init__.py +17 -0
  125. package/planqk/service/sdk/types/hal_link.py +59 -0
  126. package/planqk/service/sdk/types/input_data.py +5 -0
  127. package/planqk/service/sdk/types/input_data_ref.py +27 -0
  128. package/planqk/service/sdk/types/input_params.py +5 -0
  129. package/planqk/service/sdk/types/service_execution.py +34 -0
  130. package/planqk/service/sdk/types/service_execution_status.py +8 -0
  131. package/pyproject.toml +51 -0
  132. package/scripts/update-version.sh +6 -0
  133. package/src/client.ts +4 -78
  134. package/src/index.test.ts +43 -0
  135. package/src/sdk/Client.ts +4 -7
  136. package/src/sdk/api/errors/BadRequestError.ts +1 -1
  137. package/src/sdk/api/errors/ForbiddenError.ts +1 -1
  138. package/src/sdk/api/errors/InternalServerError.ts +1 -1
  139. package/src/sdk/api/errors/NotFoundError.ts +1 -1
  140. package/src/sdk/api/errors/UnauthorizedError.ts +1 -1
  141. package/src/sdk/api/resources/index.ts +0 -3
  142. package/src/sdk/api/resources/serviceApi/client/Client.ts +205 -32
  143. package/src/sdk/api/resources/serviceApi/client/index.ts +1 -1
  144. package/src/sdk/api/resources/serviceApi/types/GetResultResponse.ts +4 -5
  145. package/src/sdk/api/resources/serviceApi/types/GetResultResponseEmbedded.ts +9 -0
  146. package/src/sdk/api/resources/serviceApi/types/GetResultResponseLinks.ts +9 -0
  147. package/src/sdk/api/resources/{statusApi → serviceApi}/types/HealthCheckResponse.ts +1 -0
  148. package/src/sdk/api/resources/serviceApi/types/index.ts +3 -1
  149. package/src/sdk/api/types/HalLink.ts +22 -0
  150. package/src/sdk/api/types/InputData.ts +1 -1
  151. package/src/sdk/api/types/{InputRef.ts → InputDataRef.ts} +1 -1
  152. package/src/sdk/api/types/InputParams.ts +1 -1
  153. package/src/sdk/api/types/{Job.ts → ServiceExecution.ts} +2 -2
  154. package/src/sdk/api/types/{JobStatus.ts → ServiceExecutionStatus.ts} +2 -2
  155. package/src/sdk/api/types/index.ts +4 -8
  156. package/src/sdk/core/fetcher/APIResponse.ts +1 -0
  157. package/src/sdk/core/fetcher/Fetcher.ts +55 -72
  158. package/src/sdk/core/fetcher/createRequestUrl.ts +10 -0
  159. package/src/sdk/core/fetcher/getFetchFn.ts +25 -0
  160. package/src/sdk/core/fetcher/getHeader.ts +8 -0
  161. package/src/sdk/core/fetcher/getRequestBody.ts +14 -0
  162. package/src/sdk/core/fetcher/getResponseBody.ts +32 -0
  163. package/src/sdk/core/fetcher/index.ts +1 -0
  164. package/src/sdk/core/fetcher/makeRequest.ts +44 -0
  165. package/src/sdk/core/fetcher/requestWithRetries.ts +21 -0
  166. package/src/sdk/core/fetcher/signals.ts +38 -0
  167. package/src/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts +252 -0
  168. package/src/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts +106 -0
  169. package/src/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts +239 -0
  170. package/src/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.ts +33 -0
  171. package/src/sdk/core/index.ts +1 -0
  172. package/src/sdk/core/runtime/index.ts +1 -0
  173. package/src/sdk/core/runtime/runtime.ts +126 -0
  174. package/tsconfig.json +15 -107
  175. package/uv.lock +1109 -0
  176. package/.eslintignore +0 -3
  177. package/.eslintrc +0 -7
  178. package/dist/sdk/api/resources/serviceApi/client/requests/GetInterimResultsRequest.d.ts +0 -9
  179. package/dist/sdk/api/resources/serviceApi/client/requests/StartExecutionRequest.d.ts +0 -13
  180. package/dist/sdk/api/resources/serviceApi/client/requests/index.d.ts +0 -2
  181. package/dist/sdk/api/resources/serviceApi/client/requests/index.js +0 -2
  182. package/dist/sdk/api/resources/statusApi/client/Client.d.ts +0 -28
  183. package/dist/sdk/api/resources/statusApi/client/Client.js +0 -97
  184. package/dist/sdk/api/resources/statusApi/client/index.d.ts +0 -1
  185. package/dist/sdk/api/resources/statusApi/client/index.js +0 -2
  186. package/dist/sdk/api/resources/statusApi/index.d.ts +0 -2
  187. package/dist/sdk/api/resources/statusApi/index.js +0 -18
  188. package/dist/sdk/api/resources/statusApi/types/index.d.ts +0 -1
  189. package/dist/sdk/api/resources/statusApi/types/index.js +0 -17
  190. package/dist/sdk/api/types/ArrayResponse.d.ts +0 -4
  191. package/dist/sdk/api/types/InterimResultResponse.d.ts +0 -4
  192. package/dist/sdk/api/types/InterimResultResponse.js +0 -5
  193. package/dist/sdk/api/types/Job.js +0 -5
  194. package/dist/sdk/api/types/NumberResponse.d.ts +0 -4
  195. package/dist/sdk/api/types/NumberResponse.js +0 -5
  196. package/dist/sdk/api/types/ObjectResponse.d.ts +0 -4
  197. package/dist/sdk/api/types/ObjectResponse.js +0 -5
  198. package/dist/sdk/api/types/StringResponse.d.ts +0 -4
  199. package/dist/sdk/api/types/StringResponse.js +0 -5
  200. package/jest.config.js +0 -12
  201. package/src/sdk/api/resources/serviceApi/client/requests/GetInterimResultsRequest.ts +0 -10
  202. package/src/sdk/api/resources/serviceApi/client/requests/StartExecutionRequest.ts +0 -15
  203. package/src/sdk/api/resources/serviceApi/client/requests/index.ts +0 -2
  204. package/src/sdk/api/resources/serviceApi/types/GetInterimResultsResponse.ts +0 -9
  205. package/src/sdk/api/resources/statusApi/client/Client.ts +0 -75
  206. package/src/sdk/api/resources/statusApi/client/index.ts +0 -1
  207. package/src/sdk/api/resources/statusApi/index.ts +0 -2
  208. package/src/sdk/api/resources/statusApi/types/index.ts +0 -1
  209. package/src/sdk/api/types/ArrayResponse.ts +0 -5
  210. package/src/sdk/api/types/InterimResultResponse.ts +0 -5
  211. package/src/sdk/api/types/NumberResponse.ts +0 -5
  212. package/src/sdk/api/types/ObjectResponse.ts +0 -5
  213. package/src/sdk/api/types/StringResponse.ts +0 -5
  214. package/tests/fixtures/complex-input.ts +0 -477
  215. package/tests/integration.test.ts +0 -92
  216. /package/dist/sdk/api/resources/serviceApi/{client/requests/GetInterimResultsRequest.js → types/GetResultResponseEmbedded.js} +0 -0
  217. /package/dist/sdk/api/resources/serviceApi/{client/requests/StartExecutionRequest.js → types/GetResultResponseLinks.js} +0 -0
  218. /package/dist/sdk/api/resources/{statusApi → serviceApi}/types/HealthCheckResponse.js +0 -0
  219. /package/dist/sdk/api/{resources/serviceApi/types/GetInterimResultsResponse.js → types/HalLink.js} +0 -0
  220. /package/dist/sdk/api/types/{ArrayResponse.js → InputDataRef.js} +0 -0
  221. /package/dist/sdk/api/types/{InputRef.js → ServiceExecution.js} +0 -0
@@ -1,477 +0,0 @@
1
- export const complexInput = {
2
- data: {
3
- classes: [
4
- {
5
- attributes: [
6
- {
7
- cardinality: 'one',
8
- id: 'plane',
9
- name: 'Plane',
10
- type: 'plane',
11
- },
12
- {
13
- cardinality: 'one',
14
- id: 'pilot',
15
- name: 'Pilot',
16
- type: 'pilot',
17
- },
18
- {
19
- cardinality: 'many',
20
- id: 'blockedTimeslot',
21
- name: 'Blocked Timeslots',
22
- type: 'timeslot',
23
- },
24
- ],
25
- id: 'flight',
26
- name: 'Flight',
27
- },
28
- {
29
- attributes: [
30
- {
31
- cardinality: 'one',
32
- id: 'airline',
33
- name: 'Airline',
34
- type: 'airline',
35
- },
36
- ],
37
- id: 'plane',
38
- name: 'Plane',
39
- },
40
- {
41
- attributes: [],
42
- id: 'airline',
43
- name: 'Airline',
44
- },
45
- {
46
- attributes: [
47
- {
48
- cardinality: 'many',
49
- id: 'airlines',
50
- name: 'airlines',
51
- type: 'airline',
52
- },
53
- {
54
- cardinality: 'one',
55
- id: 'number',
56
- name: 'number',
57
- type: 'number',
58
- },
59
- {
60
- cardinality: 'one',
61
- id: 'terminal',
62
- name: 'terminal',
63
- type: 'terminal',
64
- },
65
- ],
66
- id: 'gate',
67
- name: 'Gate',
68
- },
69
- {
70
- attributes: [],
71
- id: 'timeslot',
72
- name: 'Timeslot',
73
- },
74
- {
75
- attributes: [
76
- {
77
- cardinality: 'one',
78
- id: 'name',
79
- name: 'Name',
80
- type: 'string',
81
- },
82
- ],
83
- id: 'pilot',
84
- name: 'Pilot',
85
- },
86
- {
87
- attributes: [],
88
- id: 'terminal',
89
- name: 'Terminal',
90
- },
91
- {
92
- attributes: [
93
- {
94
- cardinality: 'one',
95
- id: 'gate',
96
- name: 'Gate',
97
- type: 'gate',
98
- },
99
- {
100
- cardinality: 'one',
101
- id: 'timeslot',
102
- name: 'Timeslot',
103
- type: 'timeslot',
104
- },
105
- ],
106
- id: 'gateTimeslot',
107
- name: 'GateTimeslot',
108
- },
109
- ],
110
- constraints: [
111
- {
112
- description: '',
113
- id: 'DiagonalIncentive',
114
- name: 'DiagonalIncentive',
115
- type: 'DiagonalIncentive',
116
- value: {},
117
- weight: -0.25,
118
- },
119
- {
120
- description: '',
121
- id: 'constraint3',
122
- name: 'Every plane can only be on one gate per time',
123
- type: 'OnlyOneScopeElementInScope',
124
- value: {
125
- onlyOneOf: 'scopeX',
126
- },
127
- weight: 2,
128
- },
129
- {
130
- description: '',
131
- id: 'constraint4',
132
- name: 'Every gateTimeslot can only be on one timeslot',
133
- type: 'OnlyOneScopeElementInScope',
134
- value: {
135
- onlyOneOf: 'scopeY',
136
- },
137
- weight: 2,
138
- },
139
- {
140
- description: '',
141
- id: 'block-timeslots of flights',
142
- name: 'Timeslots of flights.blockedTimeslot should not be in gateTimeslot.timeslot',
143
- type: 'BlockAssignmentForScopeAttribute',
144
- value: {
145
- blockedScope: 'scopeY',
146
- forBlockingClass: 'timeslot',
147
- withBlockedAttributeIds: 'blockedTimeslot',
148
- },
149
- weight: 0.5,
150
- },
151
- ],
152
- objects: [
153
- {
154
- id: 'terminal1',
155
- name: 'Terminal 1',
156
- type: 'terminal',
157
- values: [],
158
- },
159
- {
160
- id: 'terminal2',
161
- name: 'Terminal 2',
162
- type: 'terminal',
163
- values: [],
164
- },
165
- {
166
- id: 'gate 1',
167
- name: 'Gate 1',
168
- type: 'gate',
169
- values: [
170
- {
171
- attributeId: 'airlines',
172
- value: [
173
- 'emirates',
174
- 'lufthansa',
175
- ],
176
- },
177
- {
178
- attributeId: 'number',
179
- value: '1',
180
- },
181
- {
182
- attributeId: 'terminal',
183
- value: 'terminal1',
184
- },
185
- ],
186
- },
187
- {
188
- id: 'gate2',
189
- name: 'Gate 2',
190
- type: 'gate',
191
- values: [
192
- {
193
- attributeId: 'airlines',
194
- value: [
195
- 'emirates',
196
- 'lufthansa',
197
- ],
198
- },
199
- {
200
- attributeId: 'number',
201
- value: '2',
202
- },
203
- {
204
- attributeId: 'terminal',
205
- value: 'terminal1',
206
- },
207
- ],
208
- },
209
- {
210
- id: 'gate3',
211
- name: 'Gate 3',
212
- type: 'gate',
213
- values: [
214
- {
215
- attributeId: 'airlines',
216
- value: [
217
- 'emirates',
218
- 'lufthansa',
219
- ],
220
- },
221
- {
222
- attributeId: 'number',
223
- value: '3',
224
- },
225
- {
226
- attributeId: 'terminal',
227
- value: 'terminal2',
228
- },
229
- ],
230
- },
231
- {
232
- id: 'lufthansa',
233
- name: 'Lufthansa',
234
- type: 'airline',
235
- values: [],
236
- },
237
- {
238
- id: 'emirates',
239
- name: 'Emirates',
240
- type: 'airline',
241
- values: [],
242
- },
243
- {
244
- id: 'timeslot1',
245
- name: '08:00',
246
- type: 'timeslot',
247
- values: [],
248
- },
249
- {
250
- id: 'timeslot2',
251
- name: '09:00',
252
- type: 'timeslot',
253
- values: [],
254
- },
255
- {
256
- id: 'timeslot3',
257
- name: '10:00',
258
- type: 'timeslot',
259
- values: [],
260
- },
261
- {
262
- id: 'pilot1',
263
- name: 'Pilot 1',
264
- type: 'pilot',
265
- values: [
266
- {
267
- attributeId: 'name',
268
- value: 'Felix',
269
- },
270
- ],
271
- },
272
- {
273
- id: 'pilot2',
274
- name: 'Pilot 2',
275
- type: 'pilot',
276
- values: [
277
- {
278
- attributeId: 'name',
279
- value: 'Benno',
280
- },
281
- ],
282
- },
283
- {
284
- id: 'plane1',
285
- name: 'Plane 1',
286
- type: 'plane',
287
- values: [
288
- {
289
- attributeId: 'airline',
290
- value: 'emirates',
291
- },
292
- ],
293
- },
294
- {
295
- id: 'plane2',
296
- name: 'Plane 2',
297
- type: 'plane',
298
- values: [
299
- {
300
- attributeId: 'airline',
301
- value: 'lufthansa',
302
- },
303
- ],
304
- },
305
- {
306
- id: 'XY001',
307
- name: 'Flight XY001',
308
- type: 'flight',
309
- values: [
310
- {
311
- attributeId: 'plane',
312
- value: 'plane1',
313
- },
314
- {
315
- attributeId: 'pilot',
316
- value: 'pilot1',
317
- },
318
- {
319
- attributeId: 'blockedTimeslot',
320
- value: [
321
- 'timeslot1',
322
- ],
323
- },
324
- ],
325
- },
326
- {
327
- id: 'XY002',
328
- name: 'Flight XY002',
329
- type: 'flight',
330
- values: [
331
- {
332
- attributeId: 'plane',
333
- value: 'plane2',
334
- },
335
- {
336
- attributeId: 'pilot',
337
- value: 'pilot2',
338
- },
339
- {
340
- attributeId: 'blockedTimeslot',
341
- value: [
342
- 'timeslot2',
343
- ],
344
- },
345
- ],
346
- },
347
- {
348
- id: 'XY003',
349
- name: 'Flight XY003',
350
- type: 'flight',
351
- values: [
352
- {
353
- attributeId: 'plane',
354
- value: 'plane2',
355
- },
356
- {
357
- attributeId: 'pilot',
358
- value: 'pilot2',
359
- },
360
- {
361
- attributeId: 'blockedTimeslot',
362
- value: [],
363
- },
364
- ],
365
- },
366
- {
367
- id: 'gate1timeslot1',
368
- name: 'gate1timeslot1',
369
- type: 'gateTimeslot',
370
- values: [
371
- {
372
- attributeId: 'gate',
373
- value: 'gate 1',
374
- },
375
- {
376
- attributeId: 'timeslot',
377
- value: 'timeslot1',
378
- },
379
- ],
380
- },
381
- {
382
- id: 'gate1timeslot2',
383
- name: 'gate1timeslot2',
384
- type: 'gateTimeslot',
385
- values: [
386
- {
387
- attributeId: 'gate',
388
- value: 'gate 1',
389
- },
390
- {
391
- attributeId: 'timeslot',
392
- value: 'timeslot2',
393
- },
394
- ],
395
- },
396
- {
397
- id: 'gate2timeslot1',
398
- name: 'gate2timeslot1',
399
- type: 'gateTimeslot',
400
- values: [
401
- {
402
- attributeId: 'gate',
403
- value: 'gate2',
404
- },
405
- {
406
- attributeId: 'timeslot',
407
- value: 'timeslot1',
408
- },
409
- ],
410
- },
411
- {
412
- id: 'gate2timeslot2',
413
- name: 'gate2timeslot2',
414
- type: 'gateTimeslot',
415
- values: [
416
- {
417
- attributeId: 'gate',
418
- value: 'gate2',
419
- },
420
- {
421
- attributeId: 'timeslot',
422
- value: 'timeslot2',
423
- },
424
- ],
425
- },
426
- {
427
- id: 'gate3timeslot2',
428
- name: 'gate3timeslot2',
429
- type: 'gateTimeslot',
430
- values: [
431
- {
432
- attributeId: 'gate',
433
- value: 'gate3',
434
- },
435
- {
436
- attributeId: 'timeslot',
437
- value: 'timeslot2',
438
- },
439
- ],
440
- },
441
- {
442
- id: 'gate3timeslot3',
443
- name: 'gate3timeslot3',
444
- type: 'gateTimeslot',
445
- values: [
446
- {
447
- attributeId: 'gate',
448
- value: 'gate3',
449
- },
450
- {
451
- attributeId: 'timeslot',
452
- value: 'timeslot3',
453
- },
454
- ],
455
- },
456
- {
457
- id: 'gate3timeslot1',
458
- name: 'gate3timeslot1',
459
- type: 'gateTimeslot',
460
- values: [
461
- {
462
- attributeId: 'gate',
463
- value: 'gate3',
464
- },
465
- {
466
- attributeId: 'timeslot',
467
- value: 'timeslot1',
468
- },
469
- ],
470
- },
471
- ],
472
- scopeX: 'flight',
473
- scopeY: 'gateTimeslot',
474
- solutions: [],
475
- },
476
- params: {},
477
- }
@@ -1,92 +0,0 @@
1
- import {PlanqkServiceAuth, PlanqkServiceClient} from '../src'
2
- import {PlanqkServiceApiClient} from '../src/sdk'
3
- import {JobStatus, StartExecutionRequest} from '../src/sdk/api'
4
- import {complexInput} from './fixtures/complex-input'
5
-
6
- const serviceEndpoint = process.env.SERVICE_ENDPOINT || 'http://localhost:8081'
7
- const consumerKey = process.env.CONSUMER_KEY
8
- const consumerSecret = process.env.CONSUMER_SECRET
9
-
10
- test('should use client', async () => {
11
- const client = new PlanqkServiceClient(serviceEndpoint, consumerKey, consumerSecret)
12
-
13
- const health = await client.healthCheck()
14
- expect(health.status).toBe('Service is up and running')
15
-
16
- let job = await client.startExecution(complexInput)
17
- expect(job.id).toBeDefined()
18
- expect(job.status).toBe(JobStatus.Pending)
19
-
20
- job = await client.getStatus(job.id!)
21
-
22
- const result = await client.getResult(job.id!)
23
- expect(result).toBeDefined()
24
-
25
- job = await client.getStatus(job.id!)
26
- expect(job.status).toBe(JobStatus.Succeeded)
27
- }, 5 * 60 * 1000)
28
-
29
- test('should use raw client', async () => {
30
- let api: PlanqkServiceApiClient
31
- if (consumerKey && consumerSecret) {
32
- const auth = new PlanqkServiceAuth(consumerKey, consumerSecret)
33
- api = new PlanqkServiceApiClient({
34
- environment: () => serviceEndpoint,
35
- token: async () => auth.getAccessToken(),
36
- })
37
- } else {
38
- api = new PlanqkServiceApiClient({
39
- environment: () => serviceEndpoint,
40
- token: async () => Math.random().toString(36).slice(2),
41
- })
42
- }
43
-
44
- const health = await api.statusApi.healthCheck()
45
- expect(health.status).toBe('Service is up and running')
46
-
47
- const data = {input: {a: '1', b: '2'}}
48
- const params = {param1: 'value1', param2: 'value2'}
49
-
50
- let job = await api.serviceApi.startExecution({data, params})
51
- expect(job.id).toBeDefined()
52
- expect(job.status).toBe(JobStatus.Pending)
53
-
54
- job = await api.serviceApi.getStatus(job.id!)
55
- while (job.status !== JobStatus.Succeeded) {
56
- // eslint-disable-next-line no-await-in-loop
57
- job = await api.serviceApi.getStatus(job.id!)
58
- }
59
-
60
- expect(job.status).toBe(JobStatus.Succeeded)
61
-
62
- const result = await api.serviceApi.getResult(job.id!)
63
- expect(result).toBeDefined()
64
- }, 5 * 60 * 1000)
65
-
66
- test('should use client with data pool ref', async () => {
67
- const client = new PlanqkServiceClient(serviceEndpoint, consumerKey, consumerSecret)
68
-
69
- const health = await client.healthCheck()
70
- expect(health.status).toBe('Service is up and running')
71
-
72
- const request: StartExecutionRequest = {
73
- dataRef: {
74
- dataPoolId: 'e3859bb2-1959-4d3d-852b-62ee81b28a72',
75
- dataSourceDescriptorId: '1c8d341e-1c86-4e19-acae-2f84bcab55ca',
76
- fileId: 'f5251675-49c6-49f3-a3a6-de75b8335d76',
77
- },
78
- params: {},
79
- }
80
-
81
- let job = await client.startExecution(request)
82
- expect(job.id).toBeDefined()
83
- expect(job.status).toBe(JobStatus.Pending)
84
-
85
- job = await client.getStatus(job.id!)
86
-
87
- const result = await client.getResult(job.id!)
88
- expect(result).toBeDefined()
89
-
90
- job = await client.getStatus(job.id!)
91
- expect(job.status).toBe(JobStatus.Succeeded)
92
- }, 5 * 60 * 1000)