@operato/scene-integration 0.0.26 → 0.1.3

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 (103) hide show
  1. package/CHANGELOG.md +55 -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.js +2 -3
  6. package/dist/connection-control.js.map +1 -1
  7. package/dist/connection-state-subscription.d.ts +1 -0
  8. package/dist/connection-state-subscription.js +2 -3
  9. package/dist/connection-state-subscription.js.map +1 -1
  10. package/dist/data-subscription.d.ts +1 -0
  11. package/dist/data-subscription.js +2 -3
  12. package/dist/data-subscription.js.map +1 -1
  13. package/dist/scenario-control.d.ts +1 -0
  14. package/dist/scenario-control.js +4 -20
  15. package/dist/scenario-control.js.map +1 -1
  16. package/dist/scenario-instance-subscription.d.ts +1 -0
  17. package/dist/scenario-instance-subscription.js +5 -21
  18. package/dist/scenario-instance-subscription.js.map +1 -1
  19. package/dist/scenario-queue-subscription.d.ts +1 -0
  20. package/dist/scenario-queue-subscription.js +2 -3
  21. package/dist/scenario-queue-subscription.js.map +1 -1
  22. package/dist/scenario-run.d.ts +1 -0
  23. package/dist/scenario-run.js +4 -20
  24. package/dist/scenario-run.js.map +1 -1
  25. package/dist/scenario-start.d.ts +1 -0
  26. package/dist/scenario-start.js +4 -20
  27. package/dist/scenario-start.js.map +1 -1
  28. package/dist/scenario-stop.d.ts +1 -0
  29. package/dist/scenario-stop.js +4 -20
  30. package/dist/scenario-stop.js.map +1 -1
  31. package/dist/templates/connection-control.d.ts +1 -1
  32. package/dist/templates/connection-control.js +1 -1
  33. package/dist/templates/connection-control.js.map +1 -1
  34. package/dist/templates/connection-state-subscription.d.ts +1 -1
  35. package/dist/templates/connection-state-subscription.js +1 -1
  36. package/dist/templates/connection-state-subscription.js.map +1 -1
  37. package/dist/templates/data-subscription.d.ts +1 -1
  38. package/dist/templates/data-subscription.js +1 -1
  39. package/dist/templates/data-subscription.js.map +1 -1
  40. package/dist/templates/index.d.ts +1 -1
  41. package/dist/templates/scenario-control.d.ts +1 -1
  42. package/dist/templates/scenario-control.js +1 -1
  43. package/dist/templates/scenario-control.js.map +1 -1
  44. package/dist/templates/scenario-instance-subscription.d.ts +1 -1
  45. package/dist/templates/scenario-instance-subscription.js +1 -1
  46. package/dist/templates/scenario-instance-subscription.js.map +1 -1
  47. package/dist/templates/scenario-queue-subscription.d.ts +1 -1
  48. package/dist/templates/scenario-queue-subscription.js +1 -1
  49. package/dist/templates/scenario-queue-subscription.js.map +1 -1
  50. package/dist/templates/scenario-run.d.ts +1 -1
  51. package/dist/templates/scenario-run.js +1 -1
  52. package/dist/templates/scenario-run.js.map +1 -1
  53. package/dist/templates/scenario-start.d.ts +1 -1
  54. package/dist/templates/scenario-start.js +1 -1
  55. package/dist/templates/scenario-start.js.map +1 -1
  56. package/dist/templates/scenario-stop.d.ts +1 -1
  57. package/dist/templates/scenario-stop.js +1 -1
  58. package/dist/templates/scenario-stop.js.map +1 -1
  59. package/{assets → icons}/icon-camera-stream.png +0 -0
  60. package/{assets → icons}/icon-connection-control.png +0 -0
  61. package/{assets → icons}/icon-connection-state-subscription.png +0 -0
  62. package/{assets → icons}/icon-data-subscription.png +0 -0
  63. package/{assets → icons}/icon-integration.png +0 -0
  64. package/{assets → icons}/icon-scenario-control.png +0 -0
  65. package/{assets → icons}/icon-scenario-instance-subscription.png +0 -0
  66. package/{assets → icons}/icon-scenario-queue-subscription.png +0 -0
  67. package/{assets → icons}/icon-scenario-run.png +0 -0
  68. package/{assets → icons}/icon-scenario-start.png +0 -0
  69. package/{assets → icons}/icon-scenario-stop.png +0 -0
  70. package/{assets → icons}/no-image.png +0 -0
  71. package/{assets → icons}/symbol-connection-control.png +0 -0
  72. package/{assets → icons}/symbol-connection-state-subscription.png +0 -0
  73. package/{assets → icons}/symbol-data-subscription.png +0 -0
  74. package/{assets → icons}/symbol-integration.png +0 -0
  75. package/{assets → icons}/symbol-scenario-control.png +0 -0
  76. package/{assets → icons}/symbol-scenario-instance-subscription.png +0 -0
  77. package/{assets → icons}/symbol-scenario-queue-subscription.png +0 -0
  78. package/{assets → icons}/symbol-scenario-run.png +0 -0
  79. package/{assets → icons}/symbol-scenario-start.png +0 -0
  80. package/{assets → icons}/symbol-scenario-stop.png +0 -0
  81. package/package.json +6 -6
  82. package/src/client-api.ts +25 -0
  83. package/src/connection-control.ts +3 -3
  84. package/src/connection-state-subscription.ts +7 -4
  85. package/src/data-subscription.ts +3 -3
  86. package/src/scenario-control.ts +5 -21
  87. package/src/scenario-instance-subscription.ts +9 -22
  88. package/src/scenario-queue-subscription.ts +6 -3
  89. package/src/scenario-run.ts +5 -21
  90. package/src/scenario-start.ts +5 -21
  91. package/src/scenario-stop.ts +5 -21
  92. package/src/templates/connection-control.ts +1 -1
  93. package/src/templates/connection-state-subscription.ts +1 -1
  94. package/src/templates/data-subscription.ts +1 -1
  95. package/src/templates/scenario-control.ts +1 -1
  96. package/src/templates/scenario-instance-subscription.ts +1 -1
  97. package/src/templates/scenario-queue-subscription.ts +1 -1
  98. package/src/templates/scenario-run.ts +1 -1
  99. package/src/templates/scenario-start.ts +1 -1
  100. package/src/templates/scenario-stop.ts +1 -1
  101. package/tsconfig.json +1 -1
  102. package/tsconfig.tsbuildinfo +1 -1
  103. package/@types/global/index.d.ts +0 -1
package/CHANGELOG.md CHANGED
@@ -3,225 +3,188 @@
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.0.26](https://github.com/things-scene/operato-scene/compare/v0.0.25...v0.0.26) (2022-01-01)
7
-
6
+ ### [0.1.3](https://github.com/things-scene/operato-scene/compare/v0.1.2...v0.1.3) (2022-01-28)
8
7
 
9
- ### :bug: Bug Fix
10
8
 
11
- * upgrade [@operato](https://github.com/operato) modules ([ddcb27f](https://github.com/things-scene/operato-scene/commit/ddcb27f7562243d9fc581fed3090c3be42ce1d28))
9
+ ### :rocket: New Features
12
10
 
11
+ * add graphql, mqtt scene component ([e223063](https://github.com/things-scene/operato-scene/commit/e223063b562f6a6a7b6ff12f3e32df30aa920da8))
13
12
 
14
13
 
15
- ### [0.0.25](https://github.com/things-scene/operato-scene/compare/v0.0.24...v0.0.25) (2021-12-28)
14
+ ### :bug: Bug Fix
16
15
 
16
+ * applied [@operato](https://github.com/operato)@^0.3.20 ([9a1dcbd](https://github.com/things-scene/operato-scene/commit/9a1dcbd2d1ca7f95b498503c87242b6d57ee3482))
17
+ * 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))
17
18
 
18
- ### :bug: Bug Fix
19
19
 
20
- * @hatiolab/things-scene@2.7.31 ([b0d1706](https://github.com/things-scene/operato-scene/commit/b0d17064bb42ed4a60008a15d48700a328711ab8))
21
- * upgrade [@things-factory](https://github.com/things-factory) dependencies ([0deff8d](https://github.com/things-scene/operato-scene/commit/0deff8dcaba7a7e81061246298b889f6165091d7))
22
20
 
21
+ ### [0.1.2](https://github.com/things-scene/operato-scene/compare/v0.1.1...v0.1.2) (2022-01-13)
23
22
 
23
+ ### :bug: Bug Fix
24
24
 
25
- ### [0.0.24](https://github.com/things-scene/operato-scene/compare/v0.0.23...v0.0.24) (2021-12-21)
25
+ - @operato/board upgrade to 0.3.18 ([4c5d232](https://github.com/things-scene/operato-scene/commit/4c5d232d185642624501a369449df21b322384ae))
26
+ - sort scenario name list on property editor ([af568e9](https://github.com/things-scene/operato-scene/commit/af568e9665eaa818cf6608f857466f497a9aa970))
26
27
 
28
+ ### [0.1.1](https://github.com/things-scene/operato-scene/compare/v0.1.0...v0.1.1) (2022-01-03)
27
29
 
28
30
  ### :bug: Bug Fix
29
31
 
30
- * upgrade [@operato](https://github.com/operato) dependencies ([19adafd](https://github.com/things-scene/operato-scene/commit/19adafde63c6a819c905c8b325b8fca6a3ff9e70))
32
+ - [@things-factory](https://github.com/things-factory) 4.0.38 for webpack 5 ([c1b8ce2](https://github.com/things-scene/operato-scene/commit/c1b8ce2a4f069a77b75c82ef8abe2b52974fa5a2))
33
+ - @operato/board@0.3.4 ([9f7a868](https://github.com/things-scene/operato-scene/commit/9f7a86820280d24b08dabfd9c9b0f46b4c74feed))
31
34
 
35
+ ## [0.1.0](https://github.com/things-scene/operato-scene/compare/v0.0.26...v0.1.0) (2022-01-03)
32
36
 
37
+ ### :rocket: New Features
33
38
 
34
- ### [0.0.23](https://github.com/things-scene/operato-scene/compare/v0.0.22...v0.0.23) (2021-12-16)
39
+ - applied import.meta.url for native web support ([fe65672](https://github.com/things-scene/operato-scene/commit/fe65672550b15276bd9fa79ab7ac886a8502f8b0))
35
40
 
41
+ ### [0.0.26](https://github.com/things-scene/operato-scene/compare/v0.0.25...v0.0.26) (2022-01-01)
36
42
 
37
43
  ### :bug: Bug Fix
38
44
 
39
- * upgrade dependencies ([3939f9f](https://github.com/things-scene/operato-scene/commit/3939f9f4069f97a5370b616375e3ecf36cf41704))
45
+ - upgrade [@operato](https://github.com/operato) modules ([ddcb27f](https://github.com/things-scene/operato-scene/commit/ddcb27f7562243d9fc581fed3090c3be42ce1d28))
40
46
 
47
+ ### [0.0.25](https://github.com/things-scene/operato-scene/compare/v0.0.24...v0.0.25) (2021-12-28)
41
48
 
49
+ ### :bug: Bug Fix
42
50
 
43
- ### [0.0.22](https://github.com/things-scene/operato-scene/compare/v0.0.21...v0.0.22) (2021-12-14)
51
+ - @hatiolab/things-scene@2.7.31 ([b0d1706](https://github.com/things-scene/operato-scene/commit/b0d17064bb42ed4a60008a15d48700a328711ab8))
52
+ - upgrade [@things-factory](https://github.com/things-factory) dependencies ([0deff8d](https://github.com/things-scene/operato-scene/commit/0deff8dcaba7a7e81061246298b889f6165091d7))
44
53
 
54
+ ### [0.0.24](https://github.com/things-scene/operato-scene/compare/v0.0.23...v0.0.24) (2021-12-21)
45
55
 
46
56
  ### :bug: Bug Fix
47
57
 
48
- * @hatiolab/things-scene upgrade ([7841684](https://github.com/things-scene/operato-scene/commit/78416849b0a336c55450e15f09d3cb58cc5e8e51))
58
+ - upgrade [@operato](https://github.com/operato) dependencies ([19adafd](https://github.com/things-scene/operato-scene/commit/19adafde63c6a819c905c8b325b8fca6a3ff9e70))
49
59
 
60
+ ### [0.0.23](https://github.com/things-scene/operato-scene/compare/v0.0.22...v0.0.23) (2021-12-16)
50
61
 
62
+ ### :bug: Bug Fix
51
63
 
52
- ### [0.0.21](https://github.com/things-scene/operato-scene/compare/v0.0.20...v0.0.21) (2021-12-14)
64
+ - upgrade dependencies ([3939f9f](https://github.com/things-scene/operato-scene/commit/3939f9f4069f97a5370b616375e3ecf36cf41704))
53
65
 
66
+ ### [0.0.22](https://github.com/things-scene/operato-scene/compare/v0.0.21...v0.0.22) (2021-12-14)
54
67
 
55
68
  ### :bug: Bug Fix
56
69
 
57
- * @things-factory/operato-board@^4.0.17 ([713a319](https://github.com/things-scene/operato-scene/commit/713a319b55a9d27fca98a1b577898863cf89a765))
70
+ - @hatiolab/things-scene upgrade ([7841684](https://github.com/things-scene/operato-scene/commit/78416849b0a336c55450e15f09d3cb58cc5e8e51))
58
71
 
72
+ ### [0.0.21](https://github.com/things-scene/operato-scene/compare/v0.0.20...v0.0.21) (2021-12-14)
59
73
 
74
+ ### :bug: Bug Fix
60
75
 
61
- ### [0.0.20](https://github.com/things-scene/operato-scene/compare/v0.0.19...v0.0.20) (2021-12-13)
76
+ - @things-factory/operato-board@^4.0.17 ([713a319](https://github.com/things-scene/operato-scene/commit/713a319b55a9d27fca98a1b577898863cf89a765))
62
77
 
78
+ ### [0.0.20](https://github.com/things-scene/operato-scene/compare/v0.0.19...v0.0.20) (2021-12-13)
63
79
 
64
80
  ### :bug: Bug Fix
65
81
 
66
- * upgrade [@operato](https://github.com/operato) version ([fbc79cf](https://github.com/things-scene/operato-scene/commit/fbc79cfcc60f92a5c6c510dc07a42bc92b810777))
67
-
68
-
82
+ - upgrade [@operato](https://github.com/operato) version ([fbc79cf](https://github.com/things-scene/operato-scene/commit/fbc79cfcc60f92a5c6c510dc07a42bc92b810777))
69
83
 
70
84
  ### [0.0.19](https://github.com/things-scene/operato-scene/compare/v0.0.18...v0.0.19) (2021-12-12)
71
85
 
72
-
73
86
  ### :bug: Bug Fix
74
87
 
75
- * upgrade @hatiolab/things-scene, @operato/board,property-editor,data-grist ([e6743bd](https://github.com/things-scene/operato-scene/commit/e6743bda29852fdae779b893a1e825a1cb73f0f9))
76
-
77
-
88
+ - upgrade @hatiolab/things-scene, @operato/board,property-editor,data-grist ([e6743bd](https://github.com/things-scene/operato-scene/commit/e6743bda29852fdae779b893a1e825a1cb73f0f9))
78
89
 
79
90
  ### [0.0.18](https://github.com/things-scene/operato-scene/compare/v0.0.17...v0.0.18) (2021-12-11)
80
91
 
81
-
82
92
  ### :bug: Bug Fix
83
93
 
84
- * upgrade things-factory version ([e7fc142](https://github.com/things-scene/operato-scene/commit/e7fc142a70d3d54b61fdd076522dede8a5908dcd))
85
-
86
-
94
+ - upgrade things-factory version ([e7fc142](https://github.com/things-scene/operato-scene/commit/e7fc142a70d3d54b61fdd076522dede8a5908dcd))
87
95
 
88
96
  ### [0.0.17](https://github.com/things-scene/operato-scene/compare/v0.0.16...v0.0.17) (2021-12-11)
89
97
 
90
-
91
98
  ### :bug: Bug Fix
92
99
 
93
- * upgrade operato to 0.2.45 ([0032bad](https://github.com/things-scene/operato-scene/commit/0032bad0914e7fd7eae5e8cc1574df20ce7cb851))
94
-
95
-
100
+ - upgrade operato to 0.2.45 ([0032bad](https://github.com/things-scene/operato-scene/commit/0032bad0914e7fd7eae5e8cc1574df20ce7cb851))
96
101
 
97
102
  ### [0.0.16](https://github.com/things-scene/operato-scene/compare/v0.0.15...v0.0.16) (2021-12-09)
98
103
 
99
-
100
104
  ### :rocket: New Features
101
105
 
102
- * add indoor-map and gauge component ([35d8a75](https://github.com/things-scene/operato-scene/commit/35d8a75f7d691dd23ea299fd772b79d19eec5d2f))
103
-
106
+ - add indoor-map and gauge component ([35d8a75](https://github.com/things-scene/operato-scene/commit/35d8a75f7d691dd23ea299fd772b79d19eec5d2f))
104
107
 
105
108
  ### :bug: Bug Fix
106
109
 
107
- * operato dependencies ([4309938](https://github.com/things-scene/operato-scene/commit/4309938e154e6638c22c4edd66b756ca2c0e6587))
108
- * upgrade [@operato](https://github.com/operato) dependencies ([92985c7](https://github.com/things-scene/operato-scene/commit/92985c76d2b7e6d3941c2c809a85b3676a579b0e))
109
-
110
-
110
+ - operato dependencies ([4309938](https://github.com/things-scene/operato-scene/commit/4309938e154e6638c22c4edd66b756ca2c0e6587))
111
+ - upgrade [@operato](https://github.com/operato) dependencies ([92985c7](https://github.com/things-scene/operato-scene/commit/92985c76d2b7e6d3941c2c809a85b3676a579b0e))
111
112
 
112
113
  ### [0.0.15](https://github.com/things-scene/operato-scene/compare/v0.0.14...v0.0.15) (2021-12-08)
113
114
 
114
-
115
115
  ### :bug: Bug Fix
116
116
 
117
- * upgrade operato dependencies ([0c26428](https://github.com/things-scene/operato-scene/commit/0c26428d0e3236851cd46c4f507c086d9d181ff4))
118
-
119
-
117
+ - upgrade operato dependencies ([0c26428](https://github.com/things-scene/operato-scene/commit/0c26428d0e3236851cd46c4f507c086d9d181ff4))
120
118
 
121
119
  ### [0.0.14](https://github.com/things-scene/operato-scene/compare/v0.0.13...v0.0.14) (2021-12-07)
122
120
 
123
121
  **Note:** Version bump only for package @operato/scene-integration
124
122
 
125
-
126
-
127
-
128
-
129
123
  ### [0.0.13](https://github.com/things-scene/operato-scene/compare/v0.0.12...v0.0.13) (2021-12-07)
130
124
 
131
-
132
125
  ### :rocket: New Features
133
126
 
134
- * scene-grist complete ([cf87cb7](https://github.com/things-scene/operato-scene/commit/cf87cb7df0ae276341b16dee5c2e0f949703ff02))
135
-
127
+ - scene-grist complete ([cf87cb7](https://github.com/things-scene/operato-scene/commit/cf87cb7df0ae276341b16dee5c2e0f949703ff02))
136
128
 
137
129
  ### :bug: Bug Fix
138
130
 
139
- * upgrade operato version ([e5ec388](https://github.com/things-scene/operato-scene/commit/e5ec38843b215be144a06ee65dfce22acff4ca1c))
140
-
141
-
131
+ - upgrade operato version ([e5ec388](https://github.com/things-scene/operato-scene/commit/e5ec38843b215be144a06ee65dfce22acff4ca1c))
142
132
 
143
133
  ### [0.0.12](https://github.com/things-scene/operato-scene/compare/v0.0.11...v0.0.12) (2021-12-06)
144
134
 
145
135
  **Note:** Version bump only for package @operato/scene-integration
146
136
 
147
-
148
-
149
-
150
-
151
137
  ### [0.0.11](https://github.com/things-scene/operato-scene/compare/v0.0.10...v0.0.11) (2021-12-06)
152
138
 
153
-
154
139
  ### :rocket: New Features
155
140
 
156
- * add wheel-sorter, legend, timer and compass ([dc90f73](https://github.com/things-scene/operato-scene/commit/dc90f73054424c0867a1c4a28d51da6e7fab8b85))
157
- * add wheel-sorter, legend, timer and compass ([518950c](https://github.com/things-scene/operato-scene/commit/518950cb5476048504a415a1dd0a1fd2d4359a77))
158
-
159
-
141
+ - add wheel-sorter, legend, timer and compass ([dc90f73](https://github.com/things-scene/operato-scene/commit/dc90f73054424c0867a1c4a28d51da6e7fab8b85))
142
+ - add wheel-sorter, legend, timer and compass ([518950c](https://github.com/things-scene/operato-scene/commit/518950cb5476048504a415a1dd0a1fd2d4359a77))
160
143
 
161
144
  ### [0.0.10](https://github.com/things-scene/operato-scene/compare/v0.0.9...v0.0.10) (2021-12-06)
162
145
 
163
-
164
146
  ### :bug: Bug Fix
165
147
 
166
- * module things-factory for test upgraded ([6a4a853](https://github.com/things-scene/operato-scene/commit/6a4a853f6beb80403c29bd8f423902f6e9ecdd81))
167
-
148
+ - module things-factory for test upgraded ([6a4a853](https://github.com/things-scene/operato-scene/commit/6a4a853f6beb80403c29bd8f423902f6e9ecdd81))
168
149
 
169
150
  ### :rocket: New Features
170
151
 
171
- * add @operato/scene-clock ([74da632](https://github.com/things-scene/operato-scene/commit/74da632211643f47f50a886ca7173bced0132b62))
172
- * add @operato/scene-clock ([8b0d55c](https://github.com/things-scene/operato-scene/commit/8b0d55ce3ce35f0b4e8aee02703370937a30275a))
173
-
174
-
152
+ - add @operato/scene-clock ([74da632](https://github.com/things-scene/operato-scene/commit/74da632211643f47f50a886ca7173bced0132b62))
153
+ - add @operato/scene-clock ([8b0d55c](https://github.com/things-scene/operato-scene/commit/8b0d55ce3ce35f0b4e8aee02703370937a30275a))
175
154
 
176
155
  ### [0.0.9](https://github.com/things-scene/operato-scene/compare/v0.0.8...v0.0.9) (2021-12-03)
177
156
 
178
-
179
157
  ### :rocket: New Features
180
158
 
181
- * operato/scene-grist added ([5dfb9ac](https://github.com/things-scene/operato-scene/commit/5dfb9ac35f46d0b101cbcb43dc7d90c937d8e2ff))
182
-
159
+ - operato/scene-grist added ([5dfb9ac](https://github.com/things-scene/operato-scene/commit/5dfb9ac35f46d0b101cbcb43dc7d90c937d8e2ff))
183
160
 
184
161
  ### :bug: Bug Fix
185
162
 
186
- * ready to operato/scene-grist ([0cc9cc0](https://github.com/things-scene/operato-scene/commit/0cc9cc02d608be80ba5e39c017b5c2080e959da9))
187
-
188
-
163
+ - ready to operato/scene-grist ([0cc9cc0](https://github.com/things-scene/operato-scene/commit/0cc9cc02d608be80ba5e39c017b5c2080e959da9))
189
164
 
190
165
  ### [0.0.8](https://github.com/things-scene/operato-scene/compare/v0.0.7...v0.0.8) (2021-12-03)
191
166
 
192
167
  **Note:** Version bump only for package @operato/scene-integration
193
168
 
194
-
195
-
196
-
197
-
198
169
  ### [0.0.7](https://github.com/things-scene/operato-scene/compare/v0.0.6...v0.0.7) (2021-12-03)
199
170
 
200
-
201
171
  ### :bug: Bug Fix
202
172
 
203
- * integration editors ([abb6968](https://github.com/things-scene/operato-scene/commit/abb696884ba751b1379477e7f9f7a4010c98eba1))
204
-
205
-
173
+ - integration editors ([abb6968](https://github.com/things-scene/operato-scene/commit/abb696884ba751b1379477e7f9f7a4010c98eba1))
206
174
 
207
175
  ### [0.0.6](https://github.com/things-scene/operato-scene/compare/v0.0.5...v0.0.6) (2021-12-03)
208
176
 
209
-
210
177
  ### :bug: Bug Fix
211
178
 
212
- * tsconfig ([a5ce449](https://github.com/things-scene/operato-scene/commit/a5ce449078e0b5371323984b78f1fb32526489bd))
213
-
214
-
179
+ - tsconfig ([a5ce449](https://github.com/things-scene/operato-scene/commit/a5ce449078e0b5371323984b78f1fb32526489bd))
215
180
 
216
181
  ### [0.0.5](https://github.com/things-scene/operato-scene/compare/v0.0.4...v0.0.5) (2021-12-03)
217
182
 
218
-
219
183
  ### :rocket: New Features
220
184
 
221
- * add chartjs ([6b3b67b](https://github.com/things-scene/operato-scene/commit/6b3b67be882eda21a702f4f13ed5e0c4606ac934))
222
- * added scene-half-roundrect and integration ([91092e6](https://github.com/things-scene/operato-scene/commit/91092e664dd0d962e981f4acae70252f4c2ac6da))
223
-
185
+ - add chartjs ([6b3b67b](https://github.com/things-scene/operato-scene/commit/6b3b67be882eda21a702f4f13ed5e0c4606ac934))
186
+ - added scene-half-roundrect and integration ([91092e6](https://github.com/things-scene/operato-scene/commit/91092e664dd0d962e981f4acae70252f4c2ac6da))
224
187
 
225
188
  ### :bug: Bug Fix
226
189
 
227
- * add chartjs, integration module ([24cd106](https://github.com/things-scene/operato-scene/commit/24cd1065d13314e7ca3927a0306fed766531b851))
190
+ - 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,7 +1,6 @@
1
+ import gql from 'graphql-tag';
1
2
  import { Component, RectPath, Shape } from '@hatiolab/things-scene';
2
- import COMPONENT_IMAGE from '../assets/symbol-connection-control.png';
3
3
  import { getClient } from './origin-client';
4
- import gql from 'graphql-tag';
5
4
  const NATURE = {
6
5
  mutable: false,
7
6
  resizable: true,
@@ -60,7 +59,7 @@ export default class ConnectionControl extends RectPath(Shape) {
60
59
  static get image() {
61
60
  if (!ConnectionControl._image) {
62
61
  ConnectionControl._image = new Image();
63
- ConnectionControl._image.src = COMPONENT_IMAGE;
62
+ ConnectionControl._image.src = new URL('../icons/symbol-connection-control.png', import.meta.url).href;
64
63
  }
65
64
  return ConnectionControl._image;
66
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"connection-control.js","sourceRoot":"","sources":["../src/connection-control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAEnE,OAAO,eAAe,MAAM,yCAAyC,CAAA;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,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,IAAI,CAAC,CAAC,CAAA;gBACnF,CAAC;aACF;SACF;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,cAAc;YACrB,IAAI,EAAE,aAAa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AAC,QAAQ,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAA","sourcesContent":["import { Component, RectPath, Shape } from '@hatiolab/things-scene'\n\nimport COMPONENT_IMAGE from '../assets/symbol-connection-control.png'\nimport { getClient } from './origin-client'\nimport gql from 'graphql-tag'\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 = COMPONENT_IMAGE\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,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,IAAI,CAAC,CAAC,CAAA;gBACnF,CAAC;aACF;SACF;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,cAAc;YACrB,IAAI,EAAE,aAAa;YACnB,QAAQ,EAAE;gBACR,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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,6 +1,7 @@
1
1
  import { 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;
@@ -1,7 +1,6 @@
1
+ import gql from 'graphql-tag';
1
2
  import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene';
2
3
  import { getClient, subscribe } from './origin-client';
3
- import COMPONENT_IMAGE from '../assets/symbol-connection-state-subscription.png';
4
- import gql from 'graphql-tag';
5
4
  const NATURE = {
6
5
  mutable: false,
7
6
  resizable: true,
@@ -38,7 +37,7 @@ export default class ConnectionStateSubscription extends DataSource(RectPath(Sha
38
37
  static get image() {
39
38
  if (!ConnectionStateSubscription._image) {
40
39
  ConnectionStateSubscription._image = new Image();
41
- ConnectionStateSubscription._image.src = COMPONENT_IMAGE;
40
+ ConnectionStateSubscription._image.src = new URL('../icons/symbol-connection-state-subscription.png', import.meta.url).href;
42
41
  }
43
42
  return ConnectionStateSubscription._image;
44
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"connection-state-subscription.js","sourceRoot":"","sources":["../src/connection-state-subscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC/E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAA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,YAAY,CAAA;IAC1B,CAAC;IAED,MAAM,CAAC,OAAiC;QACtC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;QAE9C,OAAO,CAAC,SAAS,EAAE,CAAA;QACnB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,2BAA2B,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IACtF,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU;YAAE,OAAM;QAChC,IAAI,CAAC,gCAAgC,EAAE,CAAA;IACzC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;IAED,gCAAgC;QAC9B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU;YAAE,OAAM;QAChC,IAAI,CAAC,cAAc,EAAE,CAAA;IACvB,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,IAAI,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,KAAK,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 { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene'\nimport { getClient, subscribe } from './origin-client'\n\nimport COMPONENT_IMAGE from '../assets/symbol-connection-state-subscription.png'\nimport gql from 'graphql-tag'\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 = COMPONENT_IMAGE\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,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE/E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAA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,CAAC,YAAY,CAAA;IAC1B,CAAC;IAED,MAAM,CAAC,OAAiC;QACtC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;QAE9C,OAAO,CAAC,SAAS,EAAE,CAAA;QACnB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,2BAA2B,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IACtF,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU;YAAE,OAAM;QAChC,IAAI,CAAC,gCAAgC,EAAE,CAAA;IACzC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;IAED,gCAAgC;QAC9B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU;YAAE,OAAM;QAChC,IAAI,CAAC,cAAc,EAAE,CAAA;IACvB,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,IAAI,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,KAAK,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, DataSource, RectPath, Shape } 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,6 +1,7 @@
1
1
  import { 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;
@@ -1,6 +1,5 @@
1
- import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene';
2
- import COMPONENT_IMAGE from '../assets/symbol-data-subscription.png';
3
1
  import gql from 'graphql-tag';
2
+ import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene';
4
3
  import { subscribe } from './origin-client';
5
4
  const NATURE = {
6
5
  mutable: false,
@@ -20,7 +19,7 @@ export default class DataSubscription extends DataSource(RectPath(Shape)) {
20
19
  static get image() {
21
20
  if (!DataSubscription._image) {
22
21
  DataSubscription._image = new Image();
23
- DataSubscription._image.src = COMPONENT_IMAGE;
22
+ DataSubscription._image.src = new URL('../icons/symbol-data-subscription.png', import.meta.url).href;
24
23
  }
25
24
  return DataSubscription._image;
26
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"data-subscription.js","sourceRoot":"","sources":["../src/data-subscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE/E,OAAO,eAAe,MAAM,wCAAwC,CAAA;AACpE,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,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,GAA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C,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 { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene'\n\nimport COMPONENT_IMAGE from '../assets/symbol-data-subscription.png'\nimport gql from 'graphql-tag'\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 = COMPONENT_IMAGE\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-subscription.ts"],"names":[],"mappings":"AAAA,OAAO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AAK,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, 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,6 +1,7 @@
1
1
  import { 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;
@@ -1,7 +1,7 @@
1
+ import gql from 'graphql-tag';
1
2
  import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene';
2
- import COMPONENT_IMAGE from '../assets/symbol-scenario-control.png';
3
+ import { scenarios } from './client-api';
3
4
  import { getClient } from './origin-client';
4
- import gql from 'graphql-tag';
5
5
  const NATURE = {
6
6
  mutable: false,
7
7
  resizable: true,
@@ -12,23 +12,7 @@ const NATURE = {
12
12
  label: 'scenario-name',
13
13
  name: 'scenarioName',
14
14
  property: {
15
- options: async () => {
16
- var response = await getClient().query({
17
- query: gql `
18
- query {
19
- scenarios {
20
- items {
21
- name
22
- }
23
- }
24
- }
25
- `
26
- });
27
- if (response.errors) {
28
- return [''];
29
- }
30
- return [''].concat(response.data.scenarios.items.map((item) => item.name));
31
- }
15
+ options: scenarios
32
16
  }
33
17
  },
34
18
  {
@@ -60,7 +44,7 @@ export default class ScenarioControl extends DataSource(RectPath(Shape)) {
60
44
  static get image() {
61
45
  if (!ScenarioControl._image) {
62
46
  ScenarioControl._image = new Image();
63
- ScenarioControl._image.src = COMPONENT_IMAGE;
47
+ ScenarioControl._image.src = new URL('../icons/symbol-scenario-control.png', import.meta.url).href;
64
48
  }
65
49
  return ScenarioControl._image;
66
50
  }
@@ -1 +1 @@
1
- {"version":3,"file":"scenario-control.js","sourceRoot":"","sources":["../src/scenario-control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAc,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE3F,OAAO,eAAe,MAAM,uCAAuC,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,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,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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M;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 { Component, DataSource, Properties, RectPath, Shape } from '@hatiolab/things-scene'\n\nimport COMPONENT_IMAGE from '../assets/symbol-scenario-control.png'\nimport { getClient } from './origin-client'\nimport gql from 'graphql-tag'\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 = COMPONENT_IMAGE\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,EAAE,UAAU,EAAc,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE3F,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,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,SAAS;aACnB;SACF;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,cAAc;YACrB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AG,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 { scenarios } from './client-api'\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: 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"]}
@@ -1,6 +1,7 @@
1
1
  import { Shape } from '@hatiolab/things-scene';
2
2
  declare const ScenarioInstanceSubscription_base: (new (...args: any[]) => {
3
3
  isDataSource(): boolean;
4
+ _convertDataFormat(data: any, format: string): any;
4
5
  }) & typeof Shape;
5
6
  export default class ScenarioInstanceSubscription extends ScenarioInstanceSubscription_base {
6
7
  static _image: HTMLImageElement;
@@ -1,7 +1,7 @@
1
- import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene';
2
- import { getClient, subscribe } from './origin-client';
3
- import COMPONENT_IMAGE from '../assets/symbol-scenario-instance-subscription.png';
4
1
  import gql from 'graphql-tag';
2
+ import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene';
3
+ import { scenarios } from './client-api';
4
+ import { subscribe } from './origin-client';
5
5
  const NATURE = {
6
6
  mutable: false,
7
7
  resizable: true,
@@ -12,23 +12,7 @@ const NATURE = {
12
12
  label: 'scenario-name',
13
13
  name: 'scenarioName',
14
14
  property: {
15
- options: async () => {
16
- var response = await getClient().query({
17
- query: gql `
18
- query {
19
- scenarios {
20
- items {
21
- name
22
- }
23
- }
24
- }
25
- `
26
- });
27
- if (response.errors) {
28
- return [''];
29
- }
30
- return [''].concat(response.data.scenarios.items.map((item) => item.name));
31
- }
15
+ options: scenarios
32
16
  }
33
17
  },
34
18
  {
@@ -43,7 +27,7 @@ export default class ScenarioInstanceSubscription extends DataSource(RectPath(Sh
43
27
  static get image() {
44
28
  if (!ScenarioInstanceSubscription._image) {
45
29
  ScenarioInstanceSubscription._image = new Image();
46
- ScenarioInstanceSubscription._image.src = COMPONENT_IMAGE;
30
+ ScenarioInstanceSubscription._image.src = new URL('../icons/symbol-scenario-instance-subscription.png', import.meta.url).href;
47
31
  }
48
32
  return ScenarioInstanceSubscription._image;
49
33
  }