@operato/scene-integration 1.0.0-alpha.6 → 1.0.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 (51) hide show
  1. package/CHANGELOG.md +283 -6
  2. package/assets/favicon.ico +0 -0
  3. package/assets/images/spinner.png +0 -0
  4. package/dist/client-api.js +2 -2
  5. package/dist/client-api.js.map +1 -1
  6. package/dist/connection-control.d.ts +0 -5
  7. package/dist/connection-control.js +2 -27
  8. package/dist/connection-control.js.map +1 -1
  9. package/dist/connection-state-subscription.js +2 -2
  10. package/dist/connection-state-subscription.js.map +1 -1
  11. package/dist/data-subscription.js +1 -1
  12. package/dist/data-subscription.js.map +1 -1
  13. package/dist/index.d.ts +1 -2
  14. package/dist/scenario-control.d.ts +0 -4
  15. package/dist/scenario-control.js +11 -32
  16. package/dist/scenario-control.js.map +1 -1
  17. package/dist/scenario-instance-subscription.js +1 -1
  18. package/dist/scenario-instance-subscription.js.map +1 -1
  19. package/dist/scenario-queue-subscription.js +1 -1
  20. package/dist/scenario-queue-subscription.js.map +1 -1
  21. package/dist/scenario-run.d.ts +0 -4
  22. package/dist/scenario-run.js +6 -26
  23. package/dist/scenario-run.js.map +1 -1
  24. package/dist/scenario-start.d.ts +0 -5
  25. package/dist/scenario-start.js +1 -27
  26. package/dist/scenario-start.js.map +1 -1
  27. package/dist/scenario-stop.d.ts +0 -5
  28. package/dist/scenario-stop.js +1 -27
  29. package/dist/scenario-stop.js.map +1 -1
  30. package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +20 -0
  31. package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +20 -0
  32. package/logs/application-2022-07-17-17.log +13 -0
  33. package/logs/application-2022-07-17-18.log +8 -0
  34. package/logs/connections-2022-07-17-17.log +105 -0
  35. package/logs/connections-2022-07-17-18.log +70 -0
  36. package/package.json +7 -9
  37. package/src/client-api.ts +2 -2
  38. package/src/connection-control.ts +2 -34
  39. package/src/connection-state-subscription.ts +2 -3
  40. package/src/data-subscription.ts +1 -2
  41. package/src/scenario-control.ts +13 -36
  42. package/src/scenario-instance-subscription.ts +1 -1
  43. package/src/scenario-queue-subscription.ts +1 -2
  44. package/src/scenario-run.ts +7 -30
  45. package/src/scenario-start.ts +1 -33
  46. package/src/scenario-stop.ts +1 -33
  47. package/tsconfig.tsbuildinfo +1 -1
  48. package/dist/origin-client.d.ts +0 -5
  49. package/dist/origin-client.js +0 -110
  50. package/dist/origin-client.js.map +0 -1
  51. package/src/origin-client.ts +0 -133
package/CHANGELOG.md CHANGED
@@ -3,33 +3,310 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [1.0.0-alpha.6](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2022-04-05)
6
+ ## [1.0.0](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.38...v1.0.0) (2022-07-24)
7
7
 
8
8
 
9
9
  ### :bug: Bug Fix
10
10
 
11
- * [@things-factory](https://github.com/things-factory) 5.0.0-alpha.28 ([459ce88](https://github.com/things-scene/operato-scene/commit/459ce884942ab11bcd1e9b9c6af7bf045b580a41))
11
+ * latest dependencies ([b435b97](https://github.com/things-scene/operato-scene/commit/b435b970f86f7e81d820a7656ecd6e0d4878ec42))
12
12
 
13
13
 
14
14
 
15
- ## [1.0.0-alpha.5](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2022-04-03)
15
+ ## [1.0.0-alpha.38](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.37...v1.0.0-alpha.38) (2022-07-20)
16
16
 
17
17
 
18
18
  ### :bug: Bug Fix
19
19
 
20
- * upgrade lit and operato, things-factory ([f056300](https://github.com/things-scene/operato-scene/commit/f056300c0e2f85c41715d3178f12c39bf3110a34))
20
+ * latest dependencies ([668aed1](https://github.com/things-scene/operato-scene/commit/668aed12552b08366230dbfab77ac2cbf4785c95))
21
+ * latest dependencies ([8a4cf6b](https://github.com/things-scene/operato-scene/commit/8a4cf6bfc9eed2bdb991eb77df9dba4b42de45e7))
21
22
 
22
23
 
23
24
 
24
- ## [1.0.0-alpha.4](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2022-03-13)
25
+ ## [1.0.0-alpha.37](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.36...v1.0.0-alpha.37) (2022-07-17)
26
+
27
+
28
+ ### :bug: Bug Fix
29
+
30
+ * latest dependencies ([cb2e928](https://github.com/things-scene/operato-scene/commit/cb2e92871da17a11ac9c68b3c4ead5df59429973))
31
+
32
+
33
+
34
+ ## [1.0.0-alpha.36](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.35...v1.0.0-alpha.36) (2022-07-17)
35
+
36
+
37
+ ### :bug: Bug Fix
38
+
39
+ * integration use @operato/graphql client and subscribe ([d184eb3](https://github.com/things-scene/operato-scene/commit/d184eb35c9447ef1ecb6f5abe88ee1677345f487))
40
+
41
+
42
+
43
+ ## [1.0.0-alpha.35](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.34...v1.0.0-alpha.35) (2022-07-15)
44
+
45
+
46
+ ### :bug: Bug Fix
47
+
48
+ * latest dependencies ([f5ea226](https://github.com/things-scene/operato-scene/commit/f5ea2264cde9ee6a0e20586ce9e86e47a3d8d922))
49
+ * latest dependencies ([7438dd3](https://github.com/things-scene/operato-scene/commit/7438dd3de9bdef939051ff72aad4c1b5608b6ab9))
50
+
51
+
52
+
53
+ ## [1.0.0-alpha.34](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.33...v1.0.0-alpha.34) (2022-07-11)
54
+
55
+
56
+ ### :bug: Bug Fix
57
+
58
+ * latest [@things-factory](https://github.com/things-factory) ([03247f1](https://github.com/things-scene/operato-scene/commit/03247f188183fd784721521ff06ef49c440849bf))
59
+
60
+
61
+
62
+ ## [1.0.0-alpha.33](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.32...v1.0.0-alpha.33) (2022-07-09)
63
+
64
+ **Note:** Version bump only for package @operato/scene-integration
65
+
66
+
67
+
68
+
69
+
70
+ ## [1.0.0-alpha.32](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.31...v1.0.0-alpha.32) (2022-07-09)
71
+
72
+
73
+ ### :bug: Bug Fix
74
+
75
+ * latest [@things-factory](https://github.com/things-factory) ([a5ea8ba](https://github.com/things-scene/operato-scene/commit/a5ea8ba70af7ac74e7cdee77fb74a152a0079366))
76
+
77
+
78
+
79
+ ## [1.0.0-alpha.31](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.30...v1.0.0-alpha.31) (2022-07-07)
80
+
81
+ **Note:** Version bump only for package @operato/scene-integration
82
+
83
+
84
+
85
+
86
+
87
+ ## [1.0.0-alpha.30](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.29...v1.0.0-alpha.30) (2022-07-05)
88
+
89
+
90
+ ### :bug: Bug Fix
91
+
92
+ * latest [@things-factory](https://github.com/things-factory) ([dac17fa](https://github.com/things-scene/operato-scene/commit/dac17faebadfd2bd2efb7192a3b1f3aafdac0cbd))
93
+
94
+
95
+
96
+ ## [1.0.0-alpha.29](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.28...v1.0.0-alpha.29) (2022-07-03)
97
+
98
+ **Note:** Version bump only for package @operato/scene-integration
99
+
100
+
101
+
102
+
103
+
104
+ ## [1.0.0-alpha.28](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.27...v1.0.0-alpha.28) (2022-07-03)
105
+
106
+
107
+ ### :bug: Bug Fix
108
+
109
+ * latest [@operato](https://github.com/operato) [@things-factory](https://github.com/things-factory) ([6ef27eb](https://github.com/things-scene/operato-scene/commit/6ef27eba820d7641e6c7cc3cedf815c0af74a6c7))
110
+ * latest @hatiolab/things-scene [@operato](https://github.com/operato) ([353d090](https://github.com/things-scene/operato-scene/commit/353d0900a24a96aabde48405ee6ec18b1b227e09))
111
+ * latest dependencies ([4ad53db](https://github.com/things-scene/operato-scene/commit/4ad53db21b0f88856f93fcbc3a12b80011d73a1b))
112
+ * latest dependencies ([7328b85](https://github.com/things-scene/operato-scene/commit/7328b85c151feb718ca1bcdaf9ac36f9f721ed57))
113
+
114
+
115
+
116
+ ## [1.0.0-alpha.27](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.26...v1.0.0-alpha.27) (2022-06-22)
117
+
118
+
119
+ ### :bug: Bug Fix
120
+
121
+ * latest @hatiolab/things-scene ([5f7e8b6](https://github.com/things-scene/operato-scene/commit/5f7e8b6f40e7b73ac874be1d473eff847f14afe2))
122
+ * latest @hatiolab/things-scene ([1bb48f0](https://github.com/things-scene/operato-scene/commit/1bb48f0259044085f690c817dbe0383a44b15f9b))
123
+ * latest @hatiolab/things-scene [@operato](https://github.com/operato) ([ed2b7b8](https://github.com/things-scene/operato-scene/commit/ed2b7b83f0fd06780e6b9841cc6a1702b834e4ac))
124
+
125
+
126
+
127
+ ## [1.0.0-alpha.26](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.25...v1.0.0-alpha.26) (2022-06-20)
128
+
129
+ **Note:** Version bump only for package @operato/scene-integration
130
+
131
+
132
+
133
+
134
+
135
+ ## [1.0.0-alpha.25](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.24...v1.0.0-alpha.25) (2022-06-20)
136
+
137
+ **Note:** Version bump only for package @operato/scene-integration
138
+
139
+
140
+
141
+
142
+
143
+ ## [1.0.0-alpha.24](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.23...v1.0.0-alpha.24) (2022-06-20)
144
+
145
+
146
+ ### :bug: Bug Fix
147
+
148
+ * latest [@operato](https://github.com/operato) ([1a59e6f](https://github.com/things-scene/operato-scene/commit/1a59e6f0ced18902fee98b88933650e23f9ad420))
149
+ * latest dependencies ([9ee4519](https://github.com/things-scene/operato-scene/commit/9ee4519adfe49e2eac8433f31ad5dea9257a1fca))
150
+
151
+
152
+
153
+ ## [1.0.0-alpha.23](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.22...v1.0.0-alpha.23) (2022-06-16)
154
+
155
+
156
+ ### :bug: Bug Fix
157
+
158
+ * latest [@operato](https://github.com/operato) ([45a542f](https://github.com/things-scene/operato-scene/commit/45a542f484a4fe552533a35eb90f2b100e01249f))
159
+ * latest [@operato](https://github.com/operato) ([d4020ee](https://github.com/things-scene/operato-scene/commit/d4020eefc797da03d43b73708dcfd8541f5b30af))
160
+
161
+
162
+
163
+ ## [1.0.0-alpha.22](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.21...v1.0.0-alpha.22) (2022-06-16)
25
164
 
26
165
 
27
166
  ### :bug: Bug Fix
28
167
 
29
- * [@operato](https://github.com/operato) 1.0.0-alpha.17 ([a8a147c](https://github.com/things-scene/operato-scene/commit/a8a147c972ed571e35d210feb3bfbc7cd31f280b))
168
+ * latest @hatiolab/things-scene ([0928090](https://github.com/things-scene/operato-scene/commit/09280903b4b0280ee8a76a4d1c2a0bf8d0997563))
30
169
 
31
170
 
32
171
 
172
+ ## [1.0.0-alpha.21](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.20...v1.0.0-alpha.21) (2022-06-16)
173
+
174
+
175
+ ### :bug: Bug Fix
176
+
177
+ * latest [@operato](https://github.com/operato) ([8384a79](https://github.com/things-scene/operato-scene/commit/8384a79c616db7c5fb437a480bb8c8337b75db84))
178
+
179
+
180
+
181
+ ## [1.0.0-alpha.20](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.19...v1.0.0-alpha.20) (2022-06-10)
182
+
183
+ **Note:** Version bump only for package @operato/scene-integration
184
+
185
+
186
+
187
+
188
+
189
+ ## [1.0.0-alpha.19](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.18...v1.0.0-alpha.19) (2022-06-09)
190
+
191
+
192
+ ### :bug: Bug Fix
193
+
194
+ * latest [@operato](https://github.com/operato) [@things-factory](https://github.com/things-factory) ([c6a5475](https://github.com/things-scene/operato-scene/commit/c6a54751a3af539840fd57d031e09ee1552a7b4c))
195
+
196
+
197
+
198
+ ## [1.0.0-alpha.18](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.17...v1.0.0-alpha.18) (2022-05-30)
199
+
200
+
201
+ ### :bug: Bug Fix
202
+
203
+ * latest dependencies ([5fae24c](https://github.com/things-scene/operato-scene/commit/5fae24ce2e7d17b5e2e85fae4cee04cfca690549))
204
+
205
+
206
+
207
+ ## [1.0.0-alpha.17](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.16...v1.0.0-alpha.17) (2022-05-29)
208
+
209
+
210
+ ### :bug: Bug Fix
211
+
212
+ * latest things-scene & [@things-factory](https://github.com/things-factory) ([485bcce](https://github.com/things-scene/operato-scene/commit/485bccead07ccc5065088f1d458175f84083f9a5))
213
+ * update [@operato](https://github.com/operato) [@things-factory](https://github.com/things-factory) ([8552127](https://github.com/things-scene/operato-scene/commit/8552127bdda3282ac74e86b936342caa085f6bea))
214
+
215
+
216
+
217
+ ## [1.0.0-alpha.16](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.15...v1.0.0-alpha.16) (2022-05-23)
218
+
219
+
220
+ ### :rocket: New Features
221
+
222
+ * migrate data-transform from [@things-factory](https://github.com/things-factory) ([2b7c5d3](https://github.com/things-scene/operato-scene/commit/2b7c5d34027d611c5e8210cada8cd15272944fa5))
223
+
224
+
225
+ ### :bug: Bug Fix
226
+
227
+ * update dependencies ([8ef917f](https://github.com/things-scene/operato-scene/commit/8ef917f41e83126495d3b75ae3042bbd66cf12c3))
228
+
229
+
230
+
231
+ ## [1.0.0-alpha.15](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.14...v1.0.0-alpha.15) (2022-05-13)
232
+
233
+ **Note:** Version bump only for package @operato/scene-integration
234
+
235
+
236
+
237
+
238
+
239
+ ## [1.0.0-alpha.14](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.13...v1.0.0-alpha.14) (2022-05-01)
240
+
241
+
242
+ ### :bug: Bug Fix
243
+
244
+ * apply @hatiolab/things-scene 3.0.6 - memory free ([5778610](https://github.com/things-scene/operato-scene/commit/5778610aa6456709cb931a3185b189f1d3bd1ff9))
245
+
246
+
247
+
248
+ ## [1.0.0-alpha.13](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.12...v1.0.0-alpha.13) (2022-04-24)
249
+
250
+
251
+ ### :bug: Bug Fix
252
+
253
+ * "@hatiolab/things-scene": "^3.0.2" ([13057dd](https://github.com/things-scene/operato-scene/commit/13057dd2f8bbb3859abb479516c3483bcc15354b))
254
+ * @hatiolab/things-scene 3.0.5 and [@operato](https://github.com/operato) 1.0.0-beta.7 ([bd69bf1](https://github.com/things-scene/operato-scene/commit/bd69bf134c1fe6789f4964f0e6525f728eee8275))
255
+ * things-scene 3.0.1 ([288f953](https://github.com/things-scene/operato-scene/commit/288f953947d73ffa3f6e8743f8326570d1dace80))
256
+
257
+
258
+
259
+ ## [1.0.0-alpha.12](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.11...v1.0.0-alpha.12) (2022-04-18)
260
+
261
+
262
+ ### :bug: Bug Fix
263
+
264
+ * @hatiolab/things-scene 3.0.0 ([29021a5](https://github.com/things-scene/operato-scene/commit/29021a511e5dc1e91b337b155817d846883ceff7))
265
+
266
+
267
+
268
+ ## [1.0.0-alpha.11](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.10...v1.0.0-alpha.11) (2022-04-17)
269
+
270
+ **Note:** Version bump only for package @operato/scene-integration
271
+
272
+
273
+
274
+
275
+
276
+ ## [1.0.0-alpha.10](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2022-04-10)
277
+
278
+ **Note:** Version bump only for package @operato/scene-integration
279
+
280
+ ## [1.0.0-alpha.9](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2022-04-07)
281
+
282
+ **Note:** Version bump only for package @operato/scene-integration
283
+
284
+ ## [1.0.0-alpha.8](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2022-04-07)
285
+
286
+ **Note:** Version bump only for package @operato/scene-integration
287
+
288
+ ## [1.0.0-alpha.7](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2022-04-06)
289
+
290
+ **Note:** Version bump only for package @operato/scene-integration
291
+
292
+ ## [1.0.0-alpha.6](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2022-04-05)
293
+
294
+ ### :bug: Bug Fix
295
+
296
+ - [@things-factory](https://github.com/things-factory) 5.0.0-alpha.36 ([459ce88](https://github.com/things-scene/operato-scene/commit/459ce884942ab11bcd1e9b9c6af7bf045b580a41))
297
+
298
+ ## [1.0.0-alpha.5](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2022-04-03)
299
+
300
+ ### :bug: Bug Fix
301
+
302
+ - upgrade lit and operato, things-factory ([f056300](https://github.com/things-scene/operato-scene/commit/f056300c0e2f85c41715d3178f12c39bf3110a34))
303
+
304
+ ## [1.0.0-alpha.4](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2022-03-13)
305
+
306
+ ### :bug: Bug Fix
307
+
308
+ - [@operato](https://github.com/operato) 1.0.0-alpha.17 ([a8a147c](https://github.com/things-scene/operato-scene/commit/a8a147c972ed571e35d210feb3bfbc7cd31f280b))
309
+
33
310
  ## [1.0.0-alpha.3](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2022-03-13)
34
311
 
35
312
  ### :bug: Bug Fix
Binary file
Binary file
@@ -1,7 +1,7 @@
1
1
  import gql from 'graphql-tag';
2
- import { getClient } from './origin-client';
2
+ import { client } from '@operato/graphql';
3
3
  export const scenarios = async () => {
4
- var response = await getClient().query({
4
+ var response = await client.query({
5
5
  query: gql `
6
6
  query {
7
7
  scenarios {
@@ -1 +1 @@
1
- {"version":3,"file":"client-api.js","sourceRoot":"","sources":["../src/client-api.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE;IAClC,IAAI,QAAQ,GAAG,MAAM,SAAS,EAAE,CAAC,KAAK,CAAC;QACrC,KAAK,EAAE,GAAG,CAAA;;;;;;;;KAQT;KACF,CAAC,CAAA;IACF,IAAI,QAAQ,CAAC,MAAM,EAAE;QACnB,OAAO,CAAC,EAAE,CAAC,CAAA;KACZ;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACzE,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;IAE3B,OAAO,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AAC5B,CAAC,CAAA","sourcesContent":["import gql from 'graphql-tag'\n\nimport { getClient } from './origin-client'\n\nexport const scenarios = async () => {\n var response = await getClient().query({\n query: gql`\n query {\n scenarios {\n items {\n name\n }\n }\n }\n `\n })\n if (response.errors) {\n return ['']\n }\n\n const items = response.data.scenarios.items.map((item: any) => item.name)\n const sorted = items.sort()\n\n return [''].concat(sorted)\n}\n"]}
1
+ {"version":3,"file":"client-api.js","sourceRoot":"","sources":["../src/client-api.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzC,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE;IAClC,IAAI,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;QAChC,KAAK,EAAE,GAAG,CAAA;;;;;;;;KAQT;KACF,CAAC,CAAA;IACF,IAAI,QAAQ,CAAC,MAAM,EAAE;QACnB,OAAO,CAAC,EAAE,CAAC,CAAA;KACZ;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACzE,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;IAE3B,OAAO,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AAC5B,CAAC,CAAA","sourcesContent":["import gql from 'graphql-tag'\n\nimport { client } from '@operato/graphql'\n\nexport const scenarios = async () => {\n var response = await client.query({\n query: gql`\n query {\n scenarios {\n items {\n name\n }\n }\n }\n `\n })\n if (response.errors) {\n return ['']\n }\n\n const items = response.data.scenarios.items.map((item: any) => item.name)\n const sorted = items.sort()\n\n return [''].concat(sorted)\n}\n"]}
@@ -3,13 +3,8 @@ declare const ConnectionControl_base: typeof Shape;
3
3
  export default class ConnectionControl extends ConnectionControl_base {
4
4
  static _image: HTMLImageElement;
5
5
  static get image(): HTMLImageElement;
6
- private _client;
7
6
  render(context: CanvasRenderingContext2D): void;
8
- ready(): void;
9
- _init(): void;
10
- dispose(): void;
11
7
  get nature(): ComponentNature;
12
- get client(): any;
13
8
  get controlType(): string;
14
9
  set controlType(controlType: string);
15
10
  controlConnect(): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import gql from 'graphql-tag';
2
2
  import { Component, RectPath, Shape } from '@hatiolab/things-scene';
3
- import { getClient } from './origin-client';
3
+ import { client } from '@operato/graphql';
4
4
  const NATURE = {
5
5
  mutable: false,
6
6
  resizable: true,
@@ -12,7 +12,7 @@ const NATURE = {
12
12
  name: 'connectionName',
13
13
  property: {
14
14
  options: async () => {
15
- var response = await getClient().query({
15
+ var response = await client.query({
16
16
  query: gql `
17
17
  query {
18
18
  connections {
@@ -68,33 +68,9 @@ export default class ConnectionControl extends RectPath(Shape) {
68
68
  context.beginPath();
69
69
  this.drawImage(context, ConnectionControl.image, left, top, width, height);
70
70
  }
71
- ready() {
72
- super.ready();
73
- this._init();
74
- }
75
- _init() {
76
- if (!this.app.isViewMode)
77
- return;
78
- this._client = getClient();
79
- }
80
- dispose() {
81
- super.dispose();
82
- try {
83
- if (this._client) {
84
- this._client.stop();
85
- }
86
- }
87
- catch (e) {
88
- console.error(e);
89
- }
90
- delete this._client;
91
- }
92
71
  get nature() {
93
72
  return NATURE;
94
73
  }
95
- get client() {
96
- return this._client;
97
- }
98
74
  get controlType() {
99
75
  return this.getState('controlType');
100
76
  }
@@ -115,7 +91,6 @@ export default class ConnectionControl extends RectPath(Shape) {
115
91
  default:
116
92
  controlType = 'disconnect';
117
93
  }
118
- var client = this._client;
119
94
  var query = '';
120
95
  query = `mutation{
121
96
  ${controlType}Connection(name: "${connectionName}") {
@@ -1 +1 @@
1
- {"version":3,"file":"connection-control.js","sourceRoot":"","sources":["../src/connection-control.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,SAAS,EAAmB,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAEpF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,gBAAgB;YACtB,QAAQ,EAAE;gBACR,OAAO,EAAE,KAAK,IAAI,EAAE;oBAClB,IAAI,QAAQ,GAAG,MAAM,SAAS,EAAE,CAAC,KAAK,CAAC;wBACrC,KAAK,EAAE,GAAG,CAAA;;;;;;;;aAQT;qBACF,CA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W,GAAG,SAAS,CAAA;gBACvB,MAAK;YACP;gBACE,WAAW,GAAG,YAAY,CAAA;SAC7B;QAED,IAAI,MAAM,GAAG,IAAI,CAAC,OAAO,CAAA;QACzB,IAAI,KAAK,GAAG,EAAE,CAAA;QAEd,KAAK,GAAG;QACJ,WAAW,qBAAqB,cAAc;;;MAGhD,CAAA;QAEF,IAAI,MAAM,EAAE;YACV,IAAI,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;gBAChC,KAAK,EAAE,GAAG,CAAA;YACN,KAAK;SACR;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAA;SACrB;IACH,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAA","sourcesContent":["import gql from 'graphql-tag'\n\nimport { Component, ComponentNature, RectPath, Shape } from '@hatiolab/things-scene'\n\nimport { getClient } from './origin-client'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'select',\n label: 'connection-name',\n name: 'connectionName',\n property: {\n options: async () => {\n var response = await getClient().query({\n query: gql`\n query {\n connections {\n items {\n name\n }\n }\n }\n `\n })\n if (response.errors) {\n return ['']\n }\n\n return [''].concat(response.data.connections.items.map((item: any) => item.name))\n }\n }\n },\n {\n type: 'select',\n label: 'control-type',\n name: 'controlType',\n property: {\n options: [\n {\n display: '',\n value: ''\n },\n {\n display: 'connect',\n value: 'connect'\n },\n {\n display: 'disconnect',\n value: 'disconnect'\n }\n ]\n }\n }\n ],\n 'value-property': 'controlType',\n help: 'scene/component/connection-control'\n}\n\nexport default class ConnectionControl extends RectPath(Shape) {\n static _image: HTMLImageElement\n\n static get image() {\n if (!ConnectionControl._image) {\n ConnectionControl._image = new Image()\n ConnectionControl._image.src = new URL('../icons/symbol-connection-control.png', import.meta.url).href\n }\n return ConnectionControl._image\n }\n\n private _client: any\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n context.beginPath()\n this.drawImage(context, ConnectionControl.image, left, top, width, height)\n }\n\n ready() {\n super.ready()\n this._init()\n }\n\n _init() {\n if (!this.app.isViewMode) return\n\n this._client = getClient()\n }\n\n dispose() {\n super.dispose()\n\n try {\n if (this._client) {\n this._client.stop()\n }\n } catch (e) {\n console.error(e)\n }\n delete this._client\n }\n\n get nature() {\n return NATURE\n }\n\n get client() {\n return this._client\n }\n\n get controlType() {\n return this.getState('controlType')\n }\n\n set controlType(controlType: string) {\n this.setState('controlType', controlType)\n this.controlConnect()\n }\n\n async controlConnect() {\n let { controlType, connectionName } = this.state\n\n if (!connectionName || !this.app.isViewMode) return\n\n switch (controlType) {\n case 'connect':\n case true:\n case 1:\n controlType = 'connect'\n break\n default:\n controlType = 'disconnect'\n }\n\n var client = this._client\n var query = ''\n\n query = `mutation{\n ${controlType}Connection(name: \"${connectionName}\") {\n status\n }\n }`\n\n if (client) {\n var response = await client.query({\n query: gql`\n ${query}\n `\n })\n\n this.data = response\n }\n }\n}\n\nComponent.register('connection-control', ConnectionControl)\n"]}
1
+ {"version":3,"file":"connection-control.js","sourceRoot":"","sources":["../src/connection-control.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,SAAS,EAAmB,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzC,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,gBAAgB;YACtB,QAAQ,EAAE;gBACR,OAAO,EAAE,KAAK,IAAI,EAAE;oBAClB,IAAI,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;wBAChC,KAAK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,CAAC,SAAS,EAAE,CAAA;QACnB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IAC5E,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAA;IACrC,CAAC;IAED,IAAI,WAAW,CAAC,WAAmB;QACjC,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,CAAA;QACzC,IAAI,CAAC,cAAc,EAAE,CAAA;IACvB,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,IAAI,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAEhD,IAAI,CAAC,cAAc,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU;YAAE,OAAM;QAEnD,QAAQ,WAAW,EAAE;YACnB,KAAK,SAAS,CAAC;YACf,KAAK,IAAI,CAAC;YACV,KAAK,CAAC;gBACJ,WAAW,GAAG,SAAS,CAAA;gBACvB,MAAK;YACP;gBACE,WAAW,GAAG,YAAY,CAAA;SAC7B;QAED,IAAI,KAAK,GAAG,EAAE,CAAA;QAEd,KAAK,GAAG;QACJ,WAAW,qBAAqB,cAAc;;;MAGhD,CAAA;QAEF,IAAI,MAAM,EAAE;YACV,IAAI,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;gBAChC,KAAK,EAAE,GAAG,CAAA;YACN,KAAK;SACR;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAA;SACrB;IACH,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAA","sourcesContent":["import gql from 'graphql-tag'\n\nimport { Component, ComponentNature, RectPath, Shape } from '@hatiolab/things-scene'\nimport { client } from '@operato/graphql'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'select',\n label: 'connection-name',\n name: 'connectionName',\n property: {\n options: async () => {\n var response = await client.query({\n query: gql`\n query {\n connections {\n items {\n name\n }\n }\n }\n `\n })\n if (response.errors) {\n return ['']\n }\n\n return [''].concat(response.data.connections.items.map((item: any) => item.name))\n }\n }\n },\n {\n type: 'select',\n label: 'control-type',\n name: 'controlType',\n property: {\n options: [\n {\n display: '',\n value: ''\n },\n {\n display: 'connect',\n value: 'connect'\n },\n {\n display: 'disconnect',\n value: 'disconnect'\n }\n ]\n }\n }\n ],\n 'value-property': 'controlType',\n help: 'scene/component/connection-control'\n}\n\nexport default class ConnectionControl extends RectPath(Shape) {\n static _image: HTMLImageElement\n\n static get image() {\n if (!ConnectionControl._image) {\n ConnectionControl._image = new Image()\n ConnectionControl._image.src = new URL('../icons/symbol-connection-control.png', import.meta.url).href\n }\n return ConnectionControl._image\n }\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n context.beginPath()\n this.drawImage(context, ConnectionControl.image, left, top, width, height)\n }\n\n get nature() {\n return NATURE\n }\n\n get controlType() {\n return this.getState('controlType')\n }\n\n set controlType(controlType: string) {\n this.setState('controlType', controlType)\n this.controlConnect()\n }\n\n async controlConnect() {\n let { controlType, connectionName } = this.state\n\n if (!connectionName || !this.app.isViewMode) return\n\n switch (controlType) {\n case 'connect':\n case true:\n case 1:\n controlType = 'connect'\n break\n default:\n controlType = 'disconnect'\n }\n\n var query = ''\n\n query = `mutation{\n ${controlType}Connection(name: \"${connectionName}\") {\n status\n }\n }`\n\n if (client) {\n var response = await client.query({\n query: gql`\n ${query}\n `\n })\n\n this.data = response\n }\n }\n}\n\nComponent.register('connection-control', ConnectionControl)\n"]}
@@ -1,6 +1,6 @@
1
1
  import gql from 'graphql-tag';
2
2
  import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene';
3
- import { getClient, subscribe } from './origin-client';
3
+ import { client, subscribe } from '@operato/graphql';
4
4
  const NATURE = {
5
5
  mutable: false,
6
6
  resizable: true,
@@ -12,7 +12,7 @@ const NATURE = {
12
12
  name: 'connectionName',
13
13
  property: {
14
14
  options: async () => {
15
- var response = await getClient().query({
15
+ var response = await client.query({
16
16
  query: gql `
17
17
  query {
18
18
  connections {
@@ -1 +1 @@
1
- {"version":3,"file":"connection-state-subscription.js","sourceRoot":"","sources":["../src/connection-state-subscription.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,SAAS,EAAmB,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAEhG,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEtD,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,gBAAgB;YACtB,QAAQ,EAAE;gBACR,OAAO,EAAE,KAAK,IAAI,EAAE;oBAClB,IAAI,QAAQ,GAAG,MAAM,SAAS,EAAE,CAAC,KAAK,CAAC;wBACrC,KAAK,EAAE,GAAG,CAAA;;;;;;;;aAQT;qBACF,CAAC,CAAA;oBACF,IAAI,QAAQ,CAAC,MAAM,EAAE;wBACnB,OAAO,CAAC,EAAE,CAAC,CAAA;qBACZ;oBAED,OAAO,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;gBACnF,CAAC;aACF;SACF;KACF;IACD,IAAI,EAAE,+CAA+C;CACtD,CAAA;AAED,MAAM,CAAC,OAAO,O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M,SAAS,CACjC;YACE,KAAK,EAAE,GAAG,CAAA;mCACiB,cAAc;;;;;UAKvC;SACH,EACD;YACE,IAAI,EAAE,KAAK,EAAE,EAAE,IAAI,EAAiB,EAAE,EAAE;gBACtC,IAAI,IAAI,EAAE;oBACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,eAAe,CAAA;iBACjC;YACH,CAAC;SACF,CACF,CAAA;IACH,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,+BAA+B,EAAE,2BAA2B,CAAC,CAAA","sourcesContent":["import gql from 'graphql-tag'\n\nimport { Component, ComponentNature, DataSource, RectPath, Shape } from '@hatiolab/things-scene'\n\nimport { getClient, subscribe } from './origin-client'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'select',\n label: 'connection-name',\n name: 'connectionName',\n property: {\n options: async () => {\n var response = await getClient().query({\n query: gql`\n query {\n connections {\n items {\n name\n }\n }\n }\n `\n })\n if (response.errors) {\n return ['']\n }\n\n return [''].concat(response.data.connections.items.map((item: any) => item.name))\n }\n }\n }\n ],\n help: 'scene/component/connection-state-subscription'\n}\n\nexport default class ConnectionStateSubscription extends DataSource(RectPath(Shape)) {\n static _image: HTMLImageElement\n static get image() {\n if (!ConnectionStateSubscription._image) {\n ConnectionStateSubscription._image = new Image()\n ConnectionStateSubscription._image.src = new URL(\n '../icons/symbol-connection-state-subscription.png',\n import.meta.url\n ).href\n }\n\n return ConnectionStateSubscription._image\n }\n\n private subscription?: {\n unsubscribe(): void\n }\n\n dispose() {\n super.dispose()\n\n this.subscription?.unsubscribe()\n delete this.subscription\n }\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, ConnectionStateSubscription.image, left, top, width, height)\n }\n\n ready() {\n if (!this.app.isViewMode) return\n this._initConnectionStateSubscription()\n }\n\n get nature() {\n return NATURE\n }\n\n _initConnectionStateSubscription() {\n if (!this.app.isViewMode) return\n this.startSubscribe()\n }\n\n async startSubscribe() {\n var { connectionName } = this.state\n\n this.subscription = await subscribe(\n {\n query: gql`subscription {\n connectionState(name: \"${connectionName}\") {\n name\n state\n timestamp\n }\n }`\n },\n {\n next: async ({ data }: { data: any }) => {\n if (data) {\n this.data = data.connectionState\n }\n }\n }\n )\n }\n}\n\nComponent.register('connection-state-subscription', ConnectionStateSubscription)\n"]}
1
+ {"version":3,"file":"connection-state-subscription.js","sourceRoot":"","sources":["../src/connection-state-subscription.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,SAAS,EAAmB,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAChG,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEpD,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,gBAAgB;YACtB,QAAQ,EAAE;gBACR,OAAO,EAAE,KAAK,IAAI,EAAE;oBAClB,IAAI,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;wBAChC,KAAK,EAAE,GAAG,CAAA;;;;;;;;aAQT;qBACF,CAAC,CAAA;oBACF,IAAI,QAAQ,CAAC,MAAM,EAAE;wBACnB,OAAO,CAAC,EAAE,CAAC,CAAA;qBACZ;oBAED,OAAO,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;gBACnF,CAAC;aACF;SACF;KACF;IACD,IAAI,EAAE,+CAA+C;CACtD,CAAA;AAED,MAAM,CA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,GAAG,MAAM,SAAS,CACjC;YACE,KAAK,EAAE,GAAG,CAAA;mCACiB,cAAc;;;;;UAKvC;SACH,EACD;YACE,IAAI,EAAE,KAAK,EAAE,EAAE,IAAI,EAAiB,EAAE,EAAE;gBACtC,IAAI,IAAI,EAAE;oBACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,eAAe,CAAA;iBACjC;YACH,CAAC;SACF,CACF,CAAA;IACH,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,+BAA+B,EAAE,2BAA2B,CAAC,CAAA","sourcesContent":["import gql from 'graphql-tag'\n\nimport { Component, ComponentNature, DataSource, RectPath, Shape } from '@hatiolab/things-scene'\nimport { client, subscribe } from '@operato/graphql'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'select',\n label: 'connection-name',\n name: 'connectionName',\n property: {\n options: async () => {\n var response = await client.query({\n query: gql`\n query {\n connections {\n items {\n name\n }\n }\n }\n `\n })\n if (response.errors) {\n return ['']\n }\n\n return [''].concat(response.data.connections.items.map((item: any) => item.name))\n }\n }\n }\n ],\n help: 'scene/component/connection-state-subscription'\n}\n\nexport default class ConnectionStateSubscription extends DataSource(RectPath(Shape)) {\n static _image: HTMLImageElement\n static get image() {\n if (!ConnectionStateSubscription._image) {\n ConnectionStateSubscription._image = new Image()\n ConnectionStateSubscription._image.src = new URL(\n '../icons/symbol-connection-state-subscription.png',\n import.meta.url\n ).href\n }\n\n return ConnectionStateSubscription._image\n }\n\n private subscription?: {\n unsubscribe(): void\n }\n\n dispose() {\n super.dispose()\n\n this.subscription?.unsubscribe()\n delete this.subscription\n }\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, ConnectionStateSubscription.image, left, top, width, height)\n }\n\n ready() {\n if (!this.app.isViewMode) return\n this._initConnectionStateSubscription()\n }\n\n get nature() {\n return NATURE\n }\n\n _initConnectionStateSubscription() {\n if (!this.app.isViewMode) return\n this.startSubscribe()\n }\n\n async startSubscribe() {\n var { connectionName } = this.state\n\n this.subscription = await subscribe(\n {\n query: gql`subscription {\n connectionState(name: \"${connectionName}\") {\n name\n state\n timestamp\n }\n }`\n },\n {\n next: async ({ data }: { data: any }) => {\n if (data) {\n this.data = data.connectionState\n }\n }\n }\n )\n }\n}\n\nComponent.register('connection-state-subscription', ConnectionStateSubscription)\n"]}
@@ -1,6 +1,6 @@
1
1
  import gql from 'graphql-tag';
2
2
  import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene';
3
- import { subscribe } from './origin-client';
3
+ import { subscribe } from '@operato/graphql';
4
4
  const NATURE = {
5
5
  mutable: false,
6
6
  resizable: true,
@@ -1 +1 @@
1
- {"version":3,"file":"data-subscription.js","sourceRoot":"","sources":["../src/data-subscription.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,SAAS,EAAmB,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAEhG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,KAAK;SACZ;KACF;IACD,gBAAgB,EAAE,KAAK;IACvB,IAAI,EAAE,mCAAmC;CAC1C,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEvE,MAAM,KAAK,KAAK;QACd,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE;YAC5B,gBAAgB,CAAC,MAAM,GAAG,IAAI,KAAK,EAAE,CAAA;YACrC,gBAAgB,CAAC,MAAM,CAAC,GAAG,GAA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,IAAI,EAAiB,EAAE,EAAE;gBACtC,IAAI,IAAI,EAAE;oBACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;iBAC3B;YACH,CAAC;SACF,CACF,CAAA;IACH,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAA","sourcesContent":["import gql from 'graphql-tag'\n\nimport { Component, ComponentNature, DataSource, RectPath, Shape } from '@hatiolab/things-scene'\n\nimport { subscribe } from './origin-client'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'string',\n label: 'tag',\n name: 'tag'\n }\n ],\n 'value-property': 'tag',\n help: 'scene/component/data-subscription'\n}\n\nexport default class DataSubscription extends DataSource(RectPath(Shape)) {\n static _image: HTMLImageElement\n static get image() {\n if (!DataSubscription._image) {\n DataSubscription._image = new Image()\n DataSubscription._image.src = new URL('../icons/symbol-data-subscription.png', import.meta.url).href\n }\n\n return DataSubscription._image\n }\n\n private subscription?: {\n unsubscribe(): void\n }\n\n dispose() {\n this.subscription?.unsubscribe()\n delete this.subscription\n\n super.dispose()\n }\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, DataSubscription.image, left, top, width, height)\n }\n\n ready() {\n this._initDataSubscription()\n }\n\n get nature() {\n return NATURE\n }\n\n get tag() {\n return this.state.tag\n }\n\n set tag(tag) {\n this.setState('tag', tag)\n }\n\n _initDataSubscription() {\n if (!this.app.isViewMode) return\n\n this.startSubscribe()\n }\n\n async startSubscribe() {\n var { tag } = this.state\n\n this.subscription = await subscribe(\n {\n query: gql`\n subscription {\n data(tag: \"${tag}\") {\n tag\n data\n }\n }\n `\n },\n {\n next: async ({ data }: { data: any }) => {\n if (data) {\n this.data = data.data.data\n }\n }\n }\n )\n }\n}\n\nComponent.register('data-subscription', DataSubscription)\n"]}
1
+ {"version":3,"file":"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AAC,OAAO,EAAE,gBAAgB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IAC3E,CAAC;IAED,KAAK;QACH,IAAI,CAAC,qBAAqB,EAAE,CAAA;IAC9B,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAA;IACvB,CAAC;IAED,IAAI,GAAG,CAAC,GAAG;QACT,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAC3B,CAAC;IAED,qBAAqB;QACnB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU;YAAE,OAAM;QAEhC,IAAI,CAAC,cAAc,EAAE,CAAA;IACvB,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAExB,IAAI,CAAC,YAAY,GAAG,MAAM,SAAS,CACjC;YACE,KAAK,EAAE,GAAG,CAAA;;yBAEO,GAAG;;;;;SAKnB;SACF,EACD;YACE,IAAI,EAAE,KAAK,EAAE,EAAE,IAAI,EAAiB,EAAE,EAAE;gBACtC,IAAI,IAAI,EAAE;oBACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;iBAC3B;YACH,CAAC;SACF,CACF,CAAA;IACH,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAA","sourcesContent":["import gql from 'graphql-tag'\n\nimport { Component, ComponentNature, DataSource, RectPath, Shape } from '@hatiolab/things-scene'\nimport { subscribe } from '@operato/graphql'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'string',\n label: 'tag',\n name: 'tag'\n }\n ],\n 'value-property': 'tag',\n help: 'scene/component/data-subscription'\n}\n\nexport default class DataSubscription extends DataSource(RectPath(Shape)) {\n static _image: HTMLImageElement\n static get image() {\n if (!DataSubscription._image) {\n DataSubscription._image = new Image()\n DataSubscription._image.src = new URL('../icons/symbol-data-subscription.png', import.meta.url).href\n }\n\n return DataSubscription._image\n }\n\n private subscription?: {\n unsubscribe(): void\n }\n\n dispose() {\n this.subscription?.unsubscribe()\n delete this.subscription\n\n super.dispose()\n }\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, DataSubscription.image, left, top, width, height)\n }\n\n ready() {\n this._initDataSubscription()\n }\n\n get nature() {\n return NATURE\n }\n\n get tag() {\n return this.state.tag\n }\n\n set tag(tag) {\n this.setState('tag', tag)\n }\n\n _initDataSubscription() {\n if (!this.app.isViewMode) return\n\n this.startSubscribe()\n }\n\n async startSubscribe() {\n var { tag } = this.state\n\n this.subscription = await subscribe(\n {\n query: gql`\n subscription {\n data(tag: \"${tag}\") {\n tag\n data\n }\n }\n `\n },\n {\n next: async ({ data }: { data: any }) => {\n if (data) {\n this.data = data.data.data\n }\n }\n }\n )\n }\n}\n\nComponent.register('data-subscription', DataSubscription)\n"]}
package/dist/index.d.ts CHANGED
@@ -1,11 +1,10 @@
1
1
  import DataSubscription from './data-subscription';
2
2
  import ScenarioControl from './scenario-control';
3
3
  import ScenarioRun from './scenario-run';
4
- import ScenarioStart from './scenario-start';
5
4
  import ScenarioStop from './scenario-stop';
6
5
  import ScenarioInstanceSubscription from './scenario-instance-subscription';
7
6
  import ScenarioQueueSubscription from './scenario-queue-subscription';
8
7
  import ConnectionStateSubscription from './connection-state-subscription';
9
8
  import ConnectionControl from './connection-control';
10
- declare const _default: (typeof ConnectionControl | typeof ConnectionStateSubscription | typeof DataSubscription | typeof ScenarioControl | typeof ScenarioRun | typeof ScenarioStart | typeof ScenarioStop | typeof ScenarioInstanceSubscription | typeof ScenarioQueueSubscription)[];
9
+ declare const _default: (typeof ConnectionControl | typeof ConnectionStateSubscription | typeof DataSubscription | typeof ScenarioControl | typeof ScenarioRun | typeof ScenarioStop | typeof ScenarioInstanceSubscription | typeof ScenarioQueueSubscription)[];
11
10
  export default _default;
@@ -6,14 +6,10 @@ declare const ScenarioControl_base: (new (...args: any[]) => {
6
6
  export default class ScenarioControl extends ScenarioControl_base {
7
7
  static _image: HTMLImageElement;
8
8
  static get image(): HTMLImageElement;
9
- private _client;
10
9
  render(context: CanvasRenderingContext2D): void;
11
10
  ready(): void;
12
- _initScenario(): void;
13
- dispose(): void;
14
11
  get nature(): ComponentNature;
15
12
  onchange(after: Properties): void;
16
- get client(): any;
17
13
  get controlType(): any;
18
14
  set controlType(controlType: any);
19
15
  requestData(): Promise<void>;
@@ -1,7 +1,7 @@
1
1
  import gql from 'graphql-tag';
2
2
  import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene';
3
+ import { client } from '@operato/graphql';
3
4
  import { scenarios } from './client-api';
4
- import { getClient } from './origin-client';
5
5
  const NATURE = {
6
6
  mutable: false,
7
7
  resizable: true,
@@ -55,25 +55,9 @@ export default class ScenarioControl extends DataSource(RectPath(Shape)) {
55
55
  }
56
56
  ready() {
57
57
  super.ready();
58
- this._initScenario();
59
- }
60
- _initScenario() {
61
- if (!this.app.isViewMode)
62
- return;
63
- this._client = getClient();
64
- this.requestData();
65
- }
66
- dispose() {
67
- super.dispose();
68
- try {
69
- if (this._client) {
70
- this._client.stop();
71
- }
72
- }
73
- catch (e) {
74
- console.error(e);
58
+ if (this.app.isViewMode) {
59
+ this.requestData();
75
60
  }
76
- delete this._client;
77
61
  }
78
62
  get nature() {
79
63
  return NATURE;
@@ -83,9 +67,6 @@ export default class ScenarioControl extends DataSource(RectPath(Shape)) {
83
67
  this.requestData();
84
68
  }
85
69
  }
86
- get client() {
87
- return this._client;
88
- }
89
70
  get controlType() {
90
71
  return this.getState('controlType');
91
72
  }
@@ -94,9 +75,9 @@ export default class ScenarioControl extends DataSource(RectPath(Shape)) {
94
75
  }
95
76
  async requestData() {
96
77
  let { controlType, scenarioName } = this.state;
97
- if (!controlType || !scenarioName || !this.app.isViewMode)
78
+ if (!controlType || !scenarioName || !this.app.isViewMode) {
98
79
  return;
99
- var client = this._client;
80
+ }
100
81
  var query = '';
101
82
  if (controlType == 'start') {
102
83
  query = `mutation{
@@ -112,14 +93,12 @@ export default class ScenarioControl extends DataSource(RectPath(Shape)) {
112
93
  }
113
94
  }`;
114
95
  }
115
- if (client) {
116
- var response = await client.query({
117
- query: gql `
118
- ${query}
119
- `
120
- });
121
- this.data = response;
122
- }
96
+ var response = await client.query({
97
+ query: gql `
98
+ ${query}
99
+ `
100
+ });
101
+ this.data = response;
123
102
  }
124
103
  }
125
104
  Component.register('scenario-control', ScenarioControl);