@operato/scene-integration 1.0.0-alpha.7 → 1.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 (42) hide show
  1. package/CHANGELOG.md +285 -7
  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/package.json +7 -9
  31. package/src/client-api.ts +2 -2
  32. package/src/connection-control.ts +2 -34
  33. package/src/connection-state-subscription.ts +2 -3
  34. package/src/data-subscription.ts +1 -2
  35. package/src/scenario-control.ts +13 -36
  36. package/src/scenario-instance-subscription.ts +1 -1
  37. package/src/scenario-queue-subscription.ts +1 -2
  38. package/src/scenario-run.ts +7 -30
  39. package/src/scenario-start.ts +1 -33
  40. package/src/scenario-stop.ts +1 -33
  41. package/tsconfig.tsbuildinfo +1 -1
  42. package/src/origin-client.ts +0 -133
package/CHANGELOG.md CHANGED
@@ -3,7 +3,72 @@
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.7](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2022-04-06)
6
+ ### [1.0.1](https://github.com/things-scene/operato-scene/compare/v1.0.0...v1.0.1) (2022-08-01)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * latest dependencies ([0e4cc8c](https://github.com/things-scene/operato-scene/commit/0e4cc8c6087f89412f1b29772656c63653648d5a))
12
+
13
+
14
+
15
+ ## [1.0.0](https://github.com/things-scene/operato-scene/compare/v1.0.0-alpha.38...v1.0.0) (2022-07-24)
16
+
17
+
18
+ ### :bug: Bug Fix
19
+
20
+ * latest dependencies ([b435b97](https://github.com/things-scene/operato-scene/commit/b435b970f86f7e81d820a7656ecd6e0d4878ec42))
21
+
22
+
23
+
24
+ ## [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)
25
+
26
+
27
+ ### :bug: Bug Fix
28
+
29
+ * latest dependencies ([668aed1](https://github.com/things-scene/operato-scene/commit/668aed12552b08366230dbfab77ac2cbf4785c95))
30
+ * latest dependencies ([8a4cf6b](https://github.com/things-scene/operato-scene/commit/8a4cf6bfc9eed2bdb991eb77df9dba4b42de45e7))
31
+
32
+
33
+
34
+ ## [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)
35
+
36
+
37
+ ### :bug: Bug Fix
38
+
39
+ * latest dependencies ([cb2e928](https://github.com/things-scene/operato-scene/commit/cb2e92871da17a11ac9c68b3c4ead5df59429973))
40
+
41
+
42
+
43
+ ## [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)
44
+
45
+
46
+ ### :bug: Bug Fix
47
+
48
+ * integration use @operato/graphql client and subscribe ([d184eb3](https://github.com/things-scene/operato-scene/commit/d184eb35c9447ef1ecb6f5abe88ee1677345f487))
49
+
50
+
51
+
52
+ ## [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)
53
+
54
+
55
+ ### :bug: Bug Fix
56
+
57
+ * latest dependencies ([f5ea226](https://github.com/things-scene/operato-scene/commit/f5ea2264cde9ee6a0e20586ce9e86e47a3d8d922))
58
+ * latest dependencies ([7438dd3](https://github.com/things-scene/operato-scene/commit/7438dd3de9bdef939051ff72aad4c1b5608b6ab9))
59
+
60
+
61
+
62
+ ## [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)
63
+
64
+
65
+ ### :bug: Bug Fix
66
+
67
+ * latest [@things-factory](https://github.com/things-factory) ([03247f1](https://github.com/things-scene/operato-scene/commit/03247f188183fd784721521ff06ef49c440849bf))
68
+
69
+
70
+
71
+ ## [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)
7
72
 
8
73
  **Note:** Version bump only for package @operato/scene-integration
9
74
 
@@ -11,33 +76,246 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
76
 
12
77
 
13
78
 
14
- ## [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)
79
+ ## [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)
15
80
 
16
81
 
17
82
  ### :bug: Bug Fix
18
83
 
19
- * [@things-factory](https://github.com/things-factory) 5.0.0-alpha.28 ([459ce88](https://github.com/things-scene/operato-scene/commit/459ce884942ab11bcd1e9b9c6af7bf045b580a41))
84
+ * latest [@things-factory](https://github.com/things-factory) ([a5ea8ba](https://github.com/things-scene/operato-scene/commit/a5ea8ba70af7ac74e7cdee77fb74a152a0079366))
20
85
 
21
86
 
22
87
 
23
- ## [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)
88
+ ## [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)
89
+
90
+ **Note:** Version bump only for package @operato/scene-integration
91
+
92
+
93
+
94
+
95
+
96
+ ## [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)
24
97
 
25
98
 
26
99
  ### :bug: Bug Fix
27
100
 
28
- * upgrade lit and operato, things-factory ([f056300](https://github.com/things-scene/operato-scene/commit/f056300c0e2f85c41715d3178f12c39bf3110a34))
101
+ * latest [@things-factory](https://github.com/things-factory) ([dac17fa](https://github.com/things-scene/operato-scene/commit/dac17faebadfd2bd2efb7192a3b1f3aafdac0cbd))
29
102
 
30
103
 
31
104
 
32
- ## [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)
105
+ ## [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)
106
+
107
+ **Note:** Version bump only for package @operato/scene-integration
108
+
109
+
110
+
111
+
112
+
113
+ ## [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)
114
+
115
+
116
+ ### :bug: Bug Fix
117
+
118
+ * latest [@operato](https://github.com/operato) [@things-factory](https://github.com/things-factory) ([6ef27eb](https://github.com/things-scene/operato-scene/commit/6ef27eba820d7641e6c7cc3cedf815c0af74a6c7))
119
+ * latest @hatiolab/things-scene [@operato](https://github.com/operato) ([353d090](https://github.com/things-scene/operato-scene/commit/353d0900a24a96aabde48405ee6ec18b1b227e09))
120
+ * latest dependencies ([4ad53db](https://github.com/things-scene/operato-scene/commit/4ad53db21b0f88856f93fcbc3a12b80011d73a1b))
121
+ * latest dependencies ([7328b85](https://github.com/things-scene/operato-scene/commit/7328b85c151feb718ca1bcdaf9ac36f9f721ed57))
122
+
123
+
124
+
125
+ ## [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)
126
+
127
+
128
+ ### :bug: Bug Fix
129
+
130
+ * latest @hatiolab/things-scene ([5f7e8b6](https://github.com/things-scene/operato-scene/commit/5f7e8b6f40e7b73ac874be1d473eff847f14afe2))
131
+ * latest @hatiolab/things-scene ([1bb48f0](https://github.com/things-scene/operato-scene/commit/1bb48f0259044085f690c817dbe0383a44b15f9b))
132
+ * latest @hatiolab/things-scene [@operato](https://github.com/operato) ([ed2b7b8](https://github.com/things-scene/operato-scene/commit/ed2b7b83f0fd06780e6b9841cc6a1702b834e4ac))
133
+
134
+
135
+
136
+ ## [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)
137
+
138
+ **Note:** Version bump only for package @operato/scene-integration
139
+
140
+
141
+
142
+
143
+
144
+ ## [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)
145
+
146
+ **Note:** Version bump only for package @operato/scene-integration
147
+
148
+
149
+
150
+
151
+
152
+ ## [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)
153
+
154
+
155
+ ### :bug: Bug Fix
156
+
157
+ * latest [@operato](https://github.com/operato) ([1a59e6f](https://github.com/things-scene/operato-scene/commit/1a59e6f0ced18902fee98b88933650e23f9ad420))
158
+ * latest dependencies ([9ee4519](https://github.com/things-scene/operato-scene/commit/9ee4519adfe49e2eac8433f31ad5dea9257a1fca))
159
+
160
+
161
+
162
+ ## [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)
163
+
164
+
165
+ ### :bug: Bug Fix
166
+
167
+ * latest [@operato](https://github.com/operato) ([45a542f](https://github.com/things-scene/operato-scene/commit/45a542f484a4fe552533a35eb90f2b100e01249f))
168
+ * latest [@operato](https://github.com/operato) ([d4020ee](https://github.com/things-scene/operato-scene/commit/d4020eefc797da03d43b73708dcfd8541f5b30af))
169
+
170
+
171
+
172
+ ## [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)
33
173
 
34
174
 
35
175
  ### :bug: Bug Fix
36
176
 
37
- * [@operato](https://github.com/operato) 1.0.0-alpha.17 ([a8a147c](https://github.com/things-scene/operato-scene/commit/a8a147c972ed571e35d210feb3bfbc7cd31f280b))
177
+ * latest @hatiolab/things-scene ([0928090](https://github.com/things-scene/operato-scene/commit/09280903b4b0280ee8a76a4d1c2a0bf8d0997563))
38
178
 
39
179
 
40
180
 
181
+ ## [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)
182
+
183
+
184
+ ### :bug: Bug Fix
185
+
186
+ * latest [@operato](https://github.com/operato) ([8384a79](https://github.com/things-scene/operato-scene/commit/8384a79c616db7c5fb437a480bb8c8337b75db84))
187
+
188
+
189
+
190
+ ## [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)
191
+
192
+ **Note:** Version bump only for package @operato/scene-integration
193
+
194
+
195
+
196
+
197
+
198
+ ## [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)
199
+
200
+
201
+ ### :bug: Bug Fix
202
+
203
+ * latest [@operato](https://github.com/operato) [@things-factory](https://github.com/things-factory) ([c6a5475](https://github.com/things-scene/operato-scene/commit/c6a54751a3af539840fd57d031e09ee1552a7b4c))
204
+
205
+
206
+
207
+ ## [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)
208
+
209
+
210
+ ### :bug: Bug Fix
211
+
212
+ * latest dependencies ([5fae24c](https://github.com/things-scene/operato-scene/commit/5fae24ce2e7d17b5e2e85fae4cee04cfca690549))
213
+
214
+
215
+
216
+ ## [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)
217
+
218
+
219
+ ### :bug: Bug Fix
220
+
221
+ * latest things-scene & [@things-factory](https://github.com/things-factory) ([485bcce](https://github.com/things-scene/operato-scene/commit/485bccead07ccc5065088f1d458175f84083f9a5))
222
+ * update [@operato](https://github.com/operato) [@things-factory](https://github.com/things-factory) ([8552127](https://github.com/things-scene/operato-scene/commit/8552127bdda3282ac74e86b936342caa085f6bea))
223
+
224
+
225
+
226
+ ## [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)
227
+
228
+
229
+ ### :rocket: New Features
230
+
231
+ * migrate data-transform from [@things-factory](https://github.com/things-factory) ([2b7c5d3](https://github.com/things-scene/operato-scene/commit/2b7c5d34027d611c5e8210cada8cd15272944fa5))
232
+
233
+
234
+ ### :bug: Bug Fix
235
+
236
+ * update dependencies ([8ef917f](https://github.com/things-scene/operato-scene/commit/8ef917f41e83126495d3b75ae3042bbd66cf12c3))
237
+
238
+
239
+
240
+ ## [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)
241
+
242
+ **Note:** Version bump only for package @operato/scene-integration
243
+
244
+
245
+
246
+
247
+
248
+ ## [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)
249
+
250
+
251
+ ### :bug: Bug Fix
252
+
253
+ * apply @hatiolab/things-scene 3.0.6 - memory free ([5778610](https://github.com/things-scene/operato-scene/commit/5778610aa6456709cb931a3185b189f1d3bd1ff9))
254
+
255
+
256
+
257
+ ## [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)
258
+
259
+
260
+ ### :bug: Bug Fix
261
+
262
+ * "@hatiolab/things-scene": "^3.0.2" ([13057dd](https://github.com/things-scene/operato-scene/commit/13057dd2f8bbb3859abb479516c3483bcc15354b))
263
+ * @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))
264
+ * things-scene 3.0.1 ([288f953](https://github.com/things-scene/operato-scene/commit/288f953947d73ffa3f6e8743f8326570d1dace80))
265
+
266
+
267
+
268
+ ## [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)
269
+
270
+
271
+ ### :bug: Bug Fix
272
+
273
+ * @hatiolab/things-scene 3.0.0 ([29021a5](https://github.com/things-scene/operato-scene/commit/29021a511e5dc1e91b337b155817d846883ceff7))
274
+
275
+
276
+
277
+ ## [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)
278
+
279
+ **Note:** Version bump only for package @operato/scene-integration
280
+
281
+
282
+
283
+
284
+
285
+ ## [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)
286
+
287
+ **Note:** Version bump only for package @operato/scene-integration
288
+
289
+ ## [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)
290
+
291
+ **Note:** Version bump only for package @operato/scene-integration
292
+
293
+ ## [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)
294
+
295
+ **Note:** Version bump only for package @operato/scene-integration
296
+
297
+ ## [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)
298
+
299
+ **Note:** Version bump only for package @operato/scene-integration
300
+
301
+ ## [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)
302
+
303
+ ### :bug: Bug Fix
304
+
305
+ - [@things-factory](https://github.com/things-factory) 5.0.0-alpha.36 ([459ce88](https://github.com/things-scene/operato-scene/commit/459ce884942ab11bcd1e9b9c6af7bf045b580a41))
306
+
307
+ ## [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)
308
+
309
+ ### :bug: Bug Fix
310
+
311
+ - upgrade lit and operato, things-factory ([f056300](https://github.com/things-scene/operato-scene/commit/f056300c0e2f85c41715d3178f12c39bf3110a34))
312
+
313
+ ## [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)
314
+
315
+ ### :bug: Bug Fix
316
+
317
+ - [@operato](https://github.com/operato) 1.0.0-alpha.17 ([a8a147c](https://github.com/things-scene/operato-scene/commit/a8a147c972ed571e35d210feb3bfbc7cd31f280b))
318
+
41
319
  ## [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)
42
320
 
43
321
  ### :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,GAA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AC;YACV,KAAK,CAAC;gBACJ,WAAW,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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Path, 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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nC,IAAI,CAAC,YAAY,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'\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,+C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,CAAA;QAEnC,IAAI,CAAC,YAAY,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,gBAA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E,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'\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', D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CAAA;QACnB,IAAI,CAAC,SAAS,CAAC,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 ScenarioQueueSubscription | typeof DataSubscription | typeof ScenarioControl | typeof ScenarioRun | typeof ScenarioStart | typeof ScenarioStop | typeof ScenarioInstanceSubscription | typeof ConnectionStateSubscription | typeof ConnectionControl)[];
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);