@operato/scene-integration 0.1.0 → 0.1.4

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 (39) hide show
  1. package/CHANGELOG.md +63 -92
  2. package/dist/client-api.d.ts +1 -0
  3. package/dist/client-api.js +22 -0
  4. package/dist/client-api.js.map +1 -0
  5. package/dist/connection-control.d.ts +2 -26
  6. package/dist/connection-control.js.map +1 -1
  7. package/dist/connection-state-subscription.d.ts +3 -15
  8. package/dist/connection-state-subscription.js.map +1 -1
  9. package/dist/data-subscription.d.ts +3 -13
  10. package/dist/data-subscription.js.map +1 -1
  11. package/dist/scenario-control.d.ts +3 -26
  12. package/dist/scenario-control.js +2 -17
  13. package/dist/scenario-control.js.map +1 -1
  14. package/dist/scenario-instance-subscription.d.ts +3 -20
  15. package/dist/scenario-instance-subscription.js +3 -18
  16. package/dist/scenario-instance-subscription.js.map +1 -1
  17. package/dist/scenario-queue-subscription.d.ts +3 -8
  18. package/dist/scenario-queue-subscription.js.map +1 -1
  19. package/dist/scenario-run.d.ts +3 -21
  20. package/dist/scenario-run.js +2 -17
  21. package/dist/scenario-run.js.map +1 -1
  22. package/dist/scenario-start.d.ts +3 -21
  23. package/dist/scenario-start.js +2 -17
  24. package/dist/scenario-start.js.map +1 -1
  25. package/dist/scenario-stop.d.ts +3 -21
  26. package/dist/scenario-stop.js +2 -17
  27. package/dist/scenario-stop.js.map +1 -1
  28. package/package.json +6 -6
  29. package/src/client-api.ts +25 -0
  30. package/src/connection-control.ts +2 -2
  31. package/src/connection-state-subscription.ts +2 -2
  32. package/src/data-subscription.ts +2 -2
  33. package/src/scenario-control.ts +4 -20
  34. package/src/scenario-instance-subscription.ts +5 -21
  35. package/src/scenario-queue-subscription.ts +2 -2
  36. package/src/scenario-run.ts +4 -20
  37. package/src/scenario-start.ts +4 -20
  38. package/src/scenario-stop.ts +4 -20
  39. package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -3,234 +3,205 @@
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
- ## [0.1.0](https://github.com/things-scene/operato-scene/compare/v0.0.26...v0.1.0) (2022-01-03)
6
+ ### [0.1.4](https://github.com/things-scene/operato-scene/compare/v0.1.3...v0.1.4) (2022-01-30)
7
7
 
8
8
 
9
9
  ### :rocket: New Features
10
10
 
11
- * applied import.meta.url for native web support ([fe65672](https://github.com/things-scene/operato-scene/commit/fe65672550b15276bd9fa79ab7ac886a8502f8b0))
11
+ * scene-label migrated from things-factory project ([3c9033c](https://github.com/things-scene/operato-scene/commit/3c9033c9af28bdd0377ac4a538ef7d4bfd38d488))
12
12
 
13
13
 
14
+ ### :bug: Bug Fix
14
15
 
15
- ### [0.0.26](https://github.com/things-scene/operato-scene/compare/v0.0.25...v0.0.26) (2022-01-01)
16
+ * applied [@operato](https://github.com/operato) 0.3.24 ([fb4fed0](https://github.com/things-scene/operato-scene/commit/fb4fed0d9fd44d6ae38db6359fdca15fc61f167c))
17
+ * applied [@things-factory](https://github.com/things-factory)@^4.0.40 ([3d4e6cb](https://github.com/things-scene/operato-scene/commit/3d4e6cbe167f605a68333fffe18949adb5247c1d))
18
+ * upgrade [@operato](https://github.com/operato) dependencies ([7d2478e](https://github.com/things-scene/operato-scene/commit/7d2478e72586b662e6c219f0720c78cde5dd7a2d))
19
+ * upgrade [@things-factory](https://github.com/things-factory) and [@operato](https://github.com/operato) ([4d97897](https://github.com/things-scene/operato-scene/commit/4d978970d3c8aba6ecae99e3fa98e431a647e8cb))
16
20
 
17
21
 
18
- ### :bug: Bug Fix
19
22
 
20
- * upgrade [@operato](https://github.com/operato) modules ([ddcb27f](https://github.com/things-scene/operato-scene/commit/ddcb27f7562243d9fc581fed3090c3be42ce1d28))
23
+ ### [0.1.3](https://github.com/things-scene/operato-scene/compare/v0.1.2...v0.1.3) (2022-01-28)
21
24
 
22
25
 
26
+ ### :rocket: New Features
23
27
 
24
- ### [0.0.25](https://github.com/things-scene/operato-scene/compare/v0.0.24...v0.0.25) (2021-12-28)
28
+ * add graphql, mqtt scene component ([e223063](https://github.com/things-scene/operato-scene/commit/e223063b562f6a6a7b6ff12f3e32df30aa920da8))
25
29
 
26
30
 
27
31
  ### :bug: Bug Fix
28
32
 
29
- * @hatiolab/things-scene@2.7.31 ([b0d1706](https://github.com/things-scene/operato-scene/commit/b0d17064bb42ed4a60008a15d48700a328711ab8))
30
- * upgrade [@things-factory](https://github.com/things-factory) dependencies ([0deff8d](https://github.com/things-scene/operato-scene/commit/0deff8dcaba7a7e81061246298b889f6165091d7))
31
-
33
+ * applied [@operato](https://github.com/operato)@^0.3.20 ([9a1dcbd](https://github.com/things-scene/operato-scene/commit/9a1dcbd2d1ca7f95b498503c87242b6d57ee3482))
34
+ * applied [@things-factory](https://github.com/things-factory)@^4.0.38 and [@operato](https://github.com/operato)@^0.3.18 ([d506c2d](https://github.com/things-scene/operato-scene/commit/d506c2d8a58341eee235079eff9b79bfa1fe350f))
32
35
 
33
36
 
34
- ### [0.0.24](https://github.com/things-scene/operato-scene/compare/v0.0.23...v0.0.24) (2021-12-21)
35
37
 
38
+ ### [0.1.2](https://github.com/things-scene/operato-scene/compare/v0.1.1...v0.1.2) (2022-01-13)
36
39
 
37
40
  ### :bug: Bug Fix
38
41
 
39
- * upgrade [@operato](https://github.com/operato) dependencies ([19adafd](https://github.com/things-scene/operato-scene/commit/19adafde63c6a819c905c8b325b8fca6a3ff9e70))
40
-
41
-
42
-
43
- ### [0.0.23](https://github.com/things-scene/operato-scene/compare/v0.0.22...v0.0.23) (2021-12-16)
42
+ - @operato/board upgrade to 0.3.18 ([4c5d232](https://github.com/things-scene/operato-scene/commit/4c5d232d185642624501a369449df21b322384ae))
43
+ - sort scenario name list on property editor ([af568e9](https://github.com/things-scene/operato-scene/commit/af568e9665eaa818cf6608f857466f497a9aa970))
44
44
 
45
+ ### [0.1.1](https://github.com/things-scene/operato-scene/compare/v0.1.0...v0.1.1) (2022-01-03)
45
46
 
46
47
  ### :bug: Bug Fix
47
48
 
48
- * upgrade dependencies ([3939f9f](https://github.com/things-scene/operato-scene/commit/3939f9f4069f97a5370b616375e3ecf36cf41704))
49
+ - [@things-factory](https://github.com/things-factory) 4.0.38 for webpack 5 ([c1b8ce2](https://github.com/things-scene/operato-scene/commit/c1b8ce2a4f069a77b75c82ef8abe2b52974fa5a2))
50
+ - @operato/board@0.3.4 ([9f7a868](https://github.com/things-scene/operato-scene/commit/9f7a86820280d24b08dabfd9c9b0f46b4c74feed))
49
51
 
52
+ ## [0.1.0](https://github.com/things-scene/operato-scene/compare/v0.0.26...v0.1.0) (2022-01-03)
50
53
 
54
+ ### :rocket: New Features
51
55
 
52
- ### [0.0.22](https://github.com/things-scene/operato-scene/compare/v0.0.21...v0.0.22) (2021-12-14)
56
+ - applied import.meta.url for native web support ([fe65672](https://github.com/things-scene/operato-scene/commit/fe65672550b15276bd9fa79ab7ac886a8502f8b0))
53
57
 
58
+ ### [0.0.26](https://github.com/things-scene/operato-scene/compare/v0.0.25...v0.0.26) (2022-01-01)
54
59
 
55
60
  ### :bug: Bug Fix
56
61
 
57
- * @hatiolab/things-scene upgrade ([7841684](https://github.com/things-scene/operato-scene/commit/78416849b0a336c55450e15f09d3cb58cc5e8e51))
62
+ - upgrade [@operato](https://github.com/operato) modules ([ddcb27f](https://github.com/things-scene/operato-scene/commit/ddcb27f7562243d9fc581fed3090c3be42ce1d28))
58
63
 
64
+ ### [0.0.25](https://github.com/things-scene/operato-scene/compare/v0.0.24...v0.0.25) (2021-12-28)
59
65
 
66
+ ### :bug: Bug Fix
60
67
 
61
- ### [0.0.21](https://github.com/things-scene/operato-scene/compare/v0.0.20...v0.0.21) (2021-12-14)
68
+ - @hatiolab/things-scene@2.7.31 ([b0d1706](https://github.com/things-scene/operato-scene/commit/b0d17064bb42ed4a60008a15d48700a328711ab8))
69
+ - upgrade [@things-factory](https://github.com/things-factory) dependencies ([0deff8d](https://github.com/things-scene/operato-scene/commit/0deff8dcaba7a7e81061246298b889f6165091d7))
62
70
 
71
+ ### [0.0.24](https://github.com/things-scene/operato-scene/compare/v0.0.23...v0.0.24) (2021-12-21)
63
72
 
64
73
  ### :bug: Bug Fix
65
74
 
66
- * @things-factory/operato-board@^4.0.17 ([713a319](https://github.com/things-scene/operato-scene/commit/713a319b55a9d27fca98a1b577898863cf89a765))
75
+ - upgrade [@operato](https://github.com/operato) dependencies ([19adafd](https://github.com/things-scene/operato-scene/commit/19adafde63c6a819c905c8b325b8fca6a3ff9e70))
67
76
 
77
+ ### [0.0.23](https://github.com/things-scene/operato-scene/compare/v0.0.22...v0.0.23) (2021-12-16)
68
78
 
79
+ ### :bug: Bug Fix
69
80
 
70
- ### [0.0.20](https://github.com/things-scene/operato-scene/compare/v0.0.19...v0.0.20) (2021-12-13)
81
+ - upgrade dependencies ([3939f9f](https://github.com/things-scene/operato-scene/commit/3939f9f4069f97a5370b616375e3ecf36cf41704))
71
82
 
83
+ ### [0.0.22](https://github.com/things-scene/operato-scene/compare/v0.0.21...v0.0.22) (2021-12-14)
72
84
 
73
85
  ### :bug: Bug Fix
74
86
 
75
- * upgrade [@operato](https://github.com/operato) version ([fbc79cf](https://github.com/things-scene/operato-scene/commit/fbc79cfcc60f92a5c6c510dc07a42bc92b810777))
87
+ - @hatiolab/things-scene upgrade ([7841684](https://github.com/things-scene/operato-scene/commit/78416849b0a336c55450e15f09d3cb58cc5e8e51))
76
88
 
89
+ ### [0.0.21](https://github.com/things-scene/operato-scene/compare/v0.0.20...v0.0.21) (2021-12-14)
77
90
 
91
+ ### :bug: Bug Fix
78
92
 
79
- ### [0.0.19](https://github.com/things-scene/operato-scene/compare/v0.0.18...v0.0.19) (2021-12-12)
93
+ - @things-factory/operato-board@^4.0.17 ([713a319](https://github.com/things-scene/operato-scene/commit/713a319b55a9d27fca98a1b577898863cf89a765))
80
94
 
95
+ ### [0.0.20](https://github.com/things-scene/operato-scene/compare/v0.0.19...v0.0.20) (2021-12-13)
81
96
 
82
97
  ### :bug: Bug Fix
83
98
 
84
- * upgrade @hatiolab/things-scene, @operato/board,property-editor,data-grist ([e6743bd](https://github.com/things-scene/operato-scene/commit/e6743bda29852fdae779b893a1e825a1cb73f0f9))
99
+ - upgrade [@operato](https://github.com/operato) version ([fbc79cf](https://github.com/things-scene/operato-scene/commit/fbc79cfcc60f92a5c6c510dc07a42bc92b810777))
100
+
101
+ ### [0.0.19](https://github.com/things-scene/operato-scene/compare/v0.0.18...v0.0.19) (2021-12-12)
85
102
 
103
+ ### :bug: Bug Fix
86
104
 
105
+ - upgrade @hatiolab/things-scene, @operato/board,property-editor,data-grist ([e6743bd](https://github.com/things-scene/operato-scene/commit/e6743bda29852fdae779b893a1e825a1cb73f0f9))
87
106
 
88
107
  ### [0.0.18](https://github.com/things-scene/operato-scene/compare/v0.0.17...v0.0.18) (2021-12-11)
89
108
 
90
-
91
109
  ### :bug: Bug Fix
92
110
 
93
- * upgrade things-factory version ([e7fc142](https://github.com/things-scene/operato-scene/commit/e7fc142a70d3d54b61fdd076522dede8a5908dcd))
94
-
95
-
111
+ - upgrade things-factory version ([e7fc142](https://github.com/things-scene/operato-scene/commit/e7fc142a70d3d54b61fdd076522dede8a5908dcd))
96
112
 
97
113
  ### [0.0.17](https://github.com/things-scene/operato-scene/compare/v0.0.16...v0.0.17) (2021-12-11)
98
114
 
99
-
100
115
  ### :bug: Bug Fix
101
116
 
102
- * upgrade operato to 0.2.45 ([0032bad](https://github.com/things-scene/operato-scene/commit/0032bad0914e7fd7eae5e8cc1574df20ce7cb851))
103
-
104
-
117
+ - upgrade operato to 0.2.45 ([0032bad](https://github.com/things-scene/operato-scene/commit/0032bad0914e7fd7eae5e8cc1574df20ce7cb851))
105
118
 
106
119
  ### [0.0.16](https://github.com/things-scene/operato-scene/compare/v0.0.15...v0.0.16) (2021-12-09)
107
120
 
108
-
109
121
  ### :rocket: New Features
110
122
 
111
- * add indoor-map and gauge component ([35d8a75](https://github.com/things-scene/operato-scene/commit/35d8a75f7d691dd23ea299fd772b79d19eec5d2f))
112
-
123
+ - add indoor-map and gauge component ([35d8a75](https://github.com/things-scene/operato-scene/commit/35d8a75f7d691dd23ea299fd772b79d19eec5d2f))
113
124
 
114
125
  ### :bug: Bug Fix
115
126
 
116
- * operato dependencies ([4309938](https://github.com/things-scene/operato-scene/commit/4309938e154e6638c22c4edd66b756ca2c0e6587))
117
- * upgrade [@operato](https://github.com/operato) dependencies ([92985c7](https://github.com/things-scene/operato-scene/commit/92985c76d2b7e6d3941c2c809a85b3676a579b0e))
118
-
119
-
127
+ - operato dependencies ([4309938](https://github.com/things-scene/operato-scene/commit/4309938e154e6638c22c4edd66b756ca2c0e6587))
128
+ - upgrade [@operato](https://github.com/operato) dependencies ([92985c7](https://github.com/things-scene/operato-scene/commit/92985c76d2b7e6d3941c2c809a85b3676a579b0e))
120
129
 
121
130
  ### [0.0.15](https://github.com/things-scene/operato-scene/compare/v0.0.14...v0.0.15) (2021-12-08)
122
131
 
123
-
124
132
  ### :bug: Bug Fix
125
133
 
126
- * upgrade operato dependencies ([0c26428](https://github.com/things-scene/operato-scene/commit/0c26428d0e3236851cd46c4f507c086d9d181ff4))
127
-
128
-
134
+ - upgrade operato dependencies ([0c26428](https://github.com/things-scene/operato-scene/commit/0c26428d0e3236851cd46c4f507c086d9d181ff4))
129
135
 
130
136
  ### [0.0.14](https://github.com/things-scene/operato-scene/compare/v0.0.13...v0.0.14) (2021-12-07)
131
137
 
132
138
  **Note:** Version bump only for package @operato/scene-integration
133
139
 
134
-
135
-
136
-
137
-
138
140
  ### [0.0.13](https://github.com/things-scene/operato-scene/compare/v0.0.12...v0.0.13) (2021-12-07)
139
141
 
140
-
141
142
  ### :rocket: New Features
142
143
 
143
- * scene-grist complete ([cf87cb7](https://github.com/things-scene/operato-scene/commit/cf87cb7df0ae276341b16dee5c2e0f949703ff02))
144
-
144
+ - scene-grist complete ([cf87cb7](https://github.com/things-scene/operato-scene/commit/cf87cb7df0ae276341b16dee5c2e0f949703ff02))
145
145
 
146
146
  ### :bug: Bug Fix
147
147
 
148
- * upgrade operato version ([e5ec388](https://github.com/things-scene/operato-scene/commit/e5ec38843b215be144a06ee65dfce22acff4ca1c))
149
-
150
-
148
+ - upgrade operato version ([e5ec388](https://github.com/things-scene/operato-scene/commit/e5ec38843b215be144a06ee65dfce22acff4ca1c))
151
149
 
152
150
  ### [0.0.12](https://github.com/things-scene/operato-scene/compare/v0.0.11...v0.0.12) (2021-12-06)
153
151
 
154
152
  **Note:** Version bump only for package @operato/scene-integration
155
153
 
156
-
157
-
158
-
159
-
160
154
  ### [0.0.11](https://github.com/things-scene/operato-scene/compare/v0.0.10...v0.0.11) (2021-12-06)
161
155
 
162
-
163
156
  ### :rocket: New Features
164
157
 
165
- * add wheel-sorter, legend, timer and compass ([dc90f73](https://github.com/things-scene/operato-scene/commit/dc90f73054424c0867a1c4a28d51da6e7fab8b85))
166
- * add wheel-sorter, legend, timer and compass ([518950c](https://github.com/things-scene/operato-scene/commit/518950cb5476048504a415a1dd0a1fd2d4359a77))
167
-
168
-
158
+ - add wheel-sorter, legend, timer and compass ([dc90f73](https://github.com/things-scene/operato-scene/commit/dc90f73054424c0867a1c4a28d51da6e7fab8b85))
159
+ - add wheel-sorter, legend, timer and compass ([518950c](https://github.com/things-scene/operato-scene/commit/518950cb5476048504a415a1dd0a1fd2d4359a77))
169
160
 
170
161
  ### [0.0.10](https://github.com/things-scene/operato-scene/compare/v0.0.9...v0.0.10) (2021-12-06)
171
162
 
172
-
173
163
  ### :bug: Bug Fix
174
164
 
175
- * module things-factory for test upgraded ([6a4a853](https://github.com/things-scene/operato-scene/commit/6a4a853f6beb80403c29bd8f423902f6e9ecdd81))
176
-
165
+ - module things-factory for test upgraded ([6a4a853](https://github.com/things-scene/operato-scene/commit/6a4a853f6beb80403c29bd8f423902f6e9ecdd81))
177
166
 
178
167
  ### :rocket: New Features
179
168
 
180
- * add @operato/scene-clock ([74da632](https://github.com/things-scene/operato-scene/commit/74da632211643f47f50a886ca7173bced0132b62))
181
- * add @operato/scene-clock ([8b0d55c](https://github.com/things-scene/operato-scene/commit/8b0d55ce3ce35f0b4e8aee02703370937a30275a))
182
-
183
-
169
+ - add @operato/scene-clock ([74da632](https://github.com/things-scene/operato-scene/commit/74da632211643f47f50a886ca7173bced0132b62))
170
+ - add @operato/scene-clock ([8b0d55c](https://github.com/things-scene/operato-scene/commit/8b0d55ce3ce35f0b4e8aee02703370937a30275a))
184
171
 
185
172
  ### [0.0.9](https://github.com/things-scene/operato-scene/compare/v0.0.8...v0.0.9) (2021-12-03)
186
173
 
187
-
188
174
  ### :rocket: New Features
189
175
 
190
- * operato/scene-grist added ([5dfb9ac](https://github.com/things-scene/operato-scene/commit/5dfb9ac35f46d0b101cbcb43dc7d90c937d8e2ff))
191
-
176
+ - operato/scene-grist added ([5dfb9ac](https://github.com/things-scene/operato-scene/commit/5dfb9ac35f46d0b101cbcb43dc7d90c937d8e2ff))
192
177
 
193
178
  ### :bug: Bug Fix
194
179
 
195
- * ready to operato/scene-grist ([0cc9cc0](https://github.com/things-scene/operato-scene/commit/0cc9cc02d608be80ba5e39c017b5c2080e959da9))
196
-
197
-
180
+ - ready to operato/scene-grist ([0cc9cc0](https://github.com/things-scene/operato-scene/commit/0cc9cc02d608be80ba5e39c017b5c2080e959da9))
198
181
 
199
182
  ### [0.0.8](https://github.com/things-scene/operato-scene/compare/v0.0.7...v0.0.8) (2021-12-03)
200
183
 
201
184
  **Note:** Version bump only for package @operato/scene-integration
202
185
 
203
-
204
-
205
-
206
-
207
186
  ### [0.0.7](https://github.com/things-scene/operato-scene/compare/v0.0.6...v0.0.7) (2021-12-03)
208
187
 
209
-
210
188
  ### :bug: Bug Fix
211
189
 
212
- * integration editors ([abb6968](https://github.com/things-scene/operato-scene/commit/abb696884ba751b1379477e7f9f7a4010c98eba1))
213
-
214
-
190
+ - integration editors ([abb6968](https://github.com/things-scene/operato-scene/commit/abb696884ba751b1379477e7f9f7a4010c98eba1))
215
191
 
216
192
  ### [0.0.6](https://github.com/things-scene/operato-scene/compare/v0.0.5...v0.0.6) (2021-12-03)
217
193
 
218
-
219
194
  ### :bug: Bug Fix
220
195
 
221
- * tsconfig ([a5ce449](https://github.com/things-scene/operato-scene/commit/a5ce449078e0b5371323984b78f1fb32526489bd))
222
-
223
-
196
+ - tsconfig ([a5ce449](https://github.com/things-scene/operato-scene/commit/a5ce449078e0b5371323984b78f1fb32526489bd))
224
197
 
225
198
  ### [0.0.5](https://github.com/things-scene/operato-scene/compare/v0.0.4...v0.0.5) (2021-12-03)
226
199
 
227
-
228
200
  ### :rocket: New Features
229
201
 
230
- * add chartjs ([6b3b67b](https://github.com/things-scene/operato-scene/commit/6b3b67be882eda21a702f4f13ed5e0c4606ac934))
231
- * added scene-half-roundrect and integration ([91092e6](https://github.com/things-scene/operato-scene/commit/91092e664dd0d962e981f4acae70252f4c2ac6da))
232
-
202
+ - add chartjs ([6b3b67b](https://github.com/things-scene/operato-scene/commit/6b3b67be882eda21a702f4f13ed5e0c4606ac934))
203
+ - added scene-half-roundrect and integration ([91092e6](https://github.com/things-scene/operato-scene/commit/91092e664dd0d962e981f4acae70252f4c2ac6da))
233
204
 
234
205
  ### :bug: Bug Fix
235
206
 
236
- * add chartjs, integration module ([24cd106](https://github.com/things-scene/operato-scene/commit/24cd1065d13314e7ca3927a0306fed766531b851))
207
+ - add chartjs, integration module ([24cd106](https://github.com/things-scene/operato-scene/commit/24cd1065d13314e7ca3927a0306fed766531b851))
@@ -0,0 +1 @@
1
+ export declare const scenarios: () => Promise<string[]>;
@@ -0,0 +1,22 @@
1
+ import gql from 'graphql-tag';
2
+ import { getClient } from './origin-client';
3
+ export const scenarios = async () => {
4
+ var response = await getClient().query({
5
+ query: gql `
6
+ query {
7
+ scenarios {
8
+ items {
9
+ name
10
+ }
11
+ }
12
+ }
13
+ `
14
+ });
15
+ if (response.errors) {
16
+ return [''];
17
+ }
18
+ const items = response.data.scenarios.items.map((item) => item.name);
19
+ const sorted = items.sort();
20
+ return [''].concat(sorted);
21
+ };
22
+ //# sourceMappingURL=client-api.js.map
@@ -0,0 +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,4 +1,4 @@
1
- import { Shape } from '@hatiolab/things-scene';
1
+ import { ComponentNature, Shape } from '@hatiolab/things-scene';
2
2
  declare const ConnectionControl_base: typeof Shape;
3
3
  export default class ConnectionControl extends ConnectionControl_base {
4
4
  static _image: HTMLImageElement;
@@ -8,31 +8,7 @@ export default class ConnectionControl extends ConnectionControl_base {
8
8
  ready(): void;
9
9
  _init(): void;
10
10
  dispose(): void;
11
- get nature(): {
12
- mutable: boolean;
13
- resizable: boolean;
14
- rotatable: boolean;
15
- properties: ({
16
- type: string;
17
- label: string;
18
- name: string;
19
- property: {
20
- options: () => Promise<string[]>;
21
- };
22
- } | {
23
- type: string;
24
- label: string;
25
- name: string;
26
- property: {
27
- options: {
28
- display: string;
29
- value: string;
30
- }[];
31
- };
32
- })[];
33
- 'value-property': string;
34
- help: string;
35
- };
11
+ get nature(): ComponentNature;
36
12
  get client(): any;
37
13
  get controlType(): string;
38
14
  set controlType(controlType: string);
@@ -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,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAEnE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,MAAM,GAAG;IACb,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,I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ACV,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, RectPath, Shape } from '@hatiolab/things-scene'\n\nimport { getClient } from './origin-client'\n\nconst NATURE = {\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;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,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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,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,6 +1,7 @@
1
- import { Shape } from '@hatiolab/things-scene';
1
+ import { ComponentNature, Shape } from '@hatiolab/things-scene';
2
2
  declare const ConnectionStateSubscription_base: (new (...args: any[]) => {
3
3
  isDataSource(): boolean;
4
+ _convertDataFormat(data: any, format: string): any;
4
5
  }) & typeof Shape;
5
6
  export default class ConnectionStateSubscription extends ConnectionStateSubscription_base {
6
7
  static _image: HTMLImageElement;
@@ -9,20 +10,7 @@ export default class ConnectionStateSubscription extends ConnectionStateSubscrip
9
10
  dispose(): void;
10
11
  render(context: CanvasRenderingContext2D): void;
11
12
  ready(): void;
12
- get nature(): {
13
- mutable: boolean;
14
- resizable: boolean;
15
- rotatable: boolean;
16
- properties: {
17
- type: string;
18
- label: string;
19
- name: string;
20
- property: {
21
- options: () => Promise<string[]>;
22
- };
23
- }[];
24
- help: string;
25
- };
13
+ get nature(): ComponentNature;
26
14
  _initConnectionStateSubscription(): void;
27
15
  startSubscribe(): Promise<void>;
28
16
  }
@@ -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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ape } from '@hatiolab/things-scene'\n\nimport { getClient, subscribe } from './origin-client'\n\nconst NATURE = {\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,EA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, 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,6 +1,7 @@
1
- import { Shape } from '@hatiolab/things-scene';
1
+ import { ComponentNature, Shape } from '@hatiolab/things-scene';
2
2
  declare const DataSubscription_base: (new (...args: any[]) => {
3
3
  isDataSource(): boolean;
4
+ _convertDataFormat(data: any, format: string): any;
4
5
  }) & typeof Shape;
5
6
  export default class DataSubscription extends DataSubscription_base {
6
7
  static _image: HTMLImageElement;
@@ -9,18 +10,7 @@ export default class DataSubscription extends DataSubscription_base {
9
10
  dispose(): void;
10
11
  render(context: CanvasRenderingContext2D): void;
11
12
  ready(): void;
12
- get nature(): {
13
- mutable: boolean;
14
- resizable: boolean;
15
- rotatable: boolean;
16
- properties: {
17
- type: string;
18
- label: string;
19
- name: string;
20
- }[];
21
- 'value-property': string;
22
- help: string;
23
- };
13
+ get nature(): ComponentNature;
24
14
  get tag(): any;
25
15
  set tag(tag: any);
26
16
  _initDataSubscription(): void;
@@ -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,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE/E,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,MAAM,GAAG;IACb,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,GAAG,IAAI,GAAG,CA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AE,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, DataSource, RectPath, Shape } from '@hatiolab/things-scene'\n\nimport { subscribe } from './origin-client'\n\nconst NATURE = {\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":"data-subscription.js","sourceRoot":"","sources":["../src/data-subsc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AAK,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'\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,6 +1,7 @@
1
- import { Properties, Shape } from '@hatiolab/things-scene';
1
+ import { ComponentNature, Properties, Shape } from '@hatiolab/things-scene';
2
2
  declare const ScenarioControl_base: (new (...args: any[]) => {
3
3
  isDataSource(): boolean;
4
+ _convertDataFormat(data: any, format: string): any;
4
5
  }) & typeof Shape;
5
6
  export default class ScenarioControl extends ScenarioControl_base {
6
7
  static _image: HTMLImageElement;
@@ -10,31 +11,7 @@ export default class ScenarioControl extends ScenarioControl_base {
10
11
  ready(): void;
11
12
  _initScenario(): void;
12
13
  dispose(): void;
13
- get nature(): {
14
- mutable: boolean;
15
- resizable: boolean;
16
- rotatable: boolean;
17
- properties: ({
18
- type: string;
19
- label: string;
20
- name: string;
21
- property: {
22
- options: () => Promise<string[]>;
23
- };
24
- } | {
25
- type: string;
26
- label: string;
27
- name: string;
28
- property: {
29
- options: {
30
- display: string;
31
- value: string;
32
- }[];
33
- };
34
- })[];
35
- 'value-property': string;
36
- help: string;
37
- };
14
+ get nature(): ComponentNature;
38
15
  onchange(after: Properties): void;
39
16
  get client(): any;
40
17
  get controlType(): any;
@@ -1,5 +1,6 @@
1
1
  import gql from 'graphql-tag';
2
2
  import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene';
3
+ import { scenarios } from './client-api';
3
4
  import { getClient } from './origin-client';
4
5
  const NATURE = {
5
6
  mutable: false,
@@ -11,23 +12,7 @@ const NATURE = {
11
12
  label: 'scenario-name',
12
13
  name: 'scenarioName',
13
14
  property: {
14
- options: async () => {
15
- var response = await getClient().query({
16
- query: gql `
17
- query {
18
- scenarios {
19
- items {
20
- name
21
- }
22
- }
23
- }
24
- `
25
- });
26
- if (response.errors) {
27
- return [''];
28
- }
29
- return [''].concat(response.data.scenarios.items.map((item) => item.name));
30
- }
15
+ options: scenarios
31
16
  }
32
17
  },
33
18
  {
@@ -1 +1 @@
1
- {"version":3,"file":"scenario-control.js","sourceRoot":"","sources":["../src/scenario-control.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAc,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE3F,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,eAAe;YACtB,IAAI,EAAE,cAAc;YACpB,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,CAA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C,GAAG,CAAC,UAAU;YAAE,OAAM;QACjE,IAAI,MAAM,GAAG,IAAI,CAAC,OAAO,CAAA;QACzB,IAAI,KAAK,GAAG,EAAE,CAAA;QACd,IAAI,WAAW,IAAI,OAAO,EAAE;YAC1B,KAAK,GAAG;UACJ,WAAW,2BAA2B,YAAY,qBAAqB,YAAY;;;QAGrF,CAAA;SACH;aAAM;YACL,KAAK,GAAG;UACJ,WAAW,2BAA2B,YAAY;;;QAGpD,CAAA;SACH;QAED,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,kBAAkB,EAAE,eAAe,CAAC,CAAA","sourcesContent":["import gql from 'graphql-tag'\n\nimport { Component, DataSource, Properties, RectPath, Shape } from '@hatiolab/things-scene'\n\nimport { getClient } from './origin-client'\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'select',\n label: 'scenario-name',\n name: 'scenarioName',\n property: {\n options: 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 return [''].concat(response.data.scenarios.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: 'start',\n value: 'start'\n },\n {\n display: 'stop',\n value: 'stop'\n }\n ]\n }\n }\n ],\n 'value-property': 'controlType',\n help: 'scene/component/scenario-control'\n}\n\nexport default class ScenarioControl extends DataSource(RectPath(Shape)) {\n static _image: HTMLImageElement\n\n static get image() {\n if (!ScenarioControl._image) {\n ScenarioControl._image = new Image()\n ScenarioControl._image.src = new URL('../icons/symbol-scenario-control.png', import.meta.url).href\n }\n return ScenarioControl._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, ScenarioControl.image, left, top, width, height)\n }\n\n ready() {\n super.ready()\n this._initScenario()\n }\n\n _initScenario() {\n if (!this.app.isViewMode) return\n\n this._client = getClient()\n this.requestData()\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 onchange(after: Properties) {\n if ('controlType' in after) {\n this.requestData()\n }\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) {\n this.setState('controlType', controlType)\n }\n\n async requestData() {\n let { controlType, scenarioName } = this.state\n if (!controlType || !scenarioName || !this.app.isViewMode) return\n var client = this._client\n var query = ''\n if (controlType == 'start') {\n query = `mutation{\n ${controlType}Scenario(instanceName: \"${scenarioName}\", scenarioName: \"${scenarioName}\", variables: {}) {\n state\n }\n }`\n } else {\n query = `mutation{\n ${controlType}Scenario(instanceName: \"${scenarioName}\") {\n state\n }\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('scenario-control', ScenarioControl)\n"]}
1
+ {"version":3,"file":"scenario-control.js","sourceRoot":"","sources":["../src/scenario-control.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,SAAS,EAAmB,UAAU,EAAc,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE5G,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,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AI,WAAW,IAAI,OAAO,EAAE;YAC1B,KAAK,GAAG;UACJ,WAAW,2BAA2B,YAAY,qBAAqB,YAAY;;;QAGrF,CAAA;SACH;aAAM;YACL,KAAK,GAAG;UACJ,WAAW,2BAA2B,YAAY;;;QAGpD,CAAA;SACH;QAED,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,kBAAkB,EAAE,eAAe,CAAC,CAAA","sourcesContent":["import gql from 'graphql-tag'\n\nimport { Component, ComponentNature, DataSource, Properties, RectPath, Shape } from '@hatiolab/things-scene'\n\nimport { scenarios } from './client-api'\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: 'scenario-name',\n name: 'scenarioName',\n property: {\n options: scenarios\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: 'start',\n value: 'start'\n },\n {\n display: 'stop',\n value: 'stop'\n }\n ]\n }\n }\n ],\n 'value-property': 'controlType',\n help: 'scene/component/scenario-control'\n}\n\nexport default class ScenarioControl extends DataSource(RectPath(Shape)) {\n static _image: HTMLImageElement\n\n static get image() {\n if (!ScenarioControl._image) {\n ScenarioControl._image = new Image()\n ScenarioControl._image.src = new URL('../icons/symbol-scenario-control.png', import.meta.url).href\n }\n return ScenarioControl._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, ScenarioControl.image, left, top, width, height)\n }\n\n ready() {\n super.ready()\n this._initScenario()\n }\n\n _initScenario() {\n if (!this.app.isViewMode) return\n\n this._client = getClient()\n this.requestData()\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 onchange(after: Properties) {\n if ('controlType' in after) {\n this.requestData()\n }\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) {\n this.setState('controlType', controlType)\n }\n\n async requestData() {\n let { controlType, scenarioName } = this.state\n if (!controlType || !scenarioName || !this.app.isViewMode) return\n var client = this._client\n var query = ''\n if (controlType == 'start') {\n query = `mutation{\n ${controlType}Scenario(instanceName: \"${scenarioName}\", scenarioName: \"${scenarioName}\", variables: {}) {\n state\n }\n }`\n } else {\n query = `mutation{\n ${controlType}Scenario(instanceName: \"${scenarioName}\") {\n state\n }\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('scenario-control', ScenarioControl)\n"]}