@operato/scene-integration 7.3.9 → 7.3.19

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 (34) hide show
  1. package/package.json +2 -2
  2. package/CHANGELOG.md +0 -914
  3. package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +0 -15
  4. package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +0 -15
  5. package/logs/application-2024-08-11-22.log +0 -105
  6. package/logs/connections-2024-08-11-22.log +0 -50
  7. package/logs/system/.ce832741a58883a058e9af6fb7483de16a838e2c-audit.json +0 -20
  8. package/logs/system/scenario-NOW-2024-08-11-22.log +0 -66
  9. package/logs/system/scenario-NOW-2024-08-11-23.log +0 -1826
  10. package/schema.graphql +0 -4369
  11. package/src/client-api.ts +0 -25
  12. package/src/connection-control.ts +0 -127
  13. package/src/connection-state-subscription.ts +0 -110
  14. package/src/data-subscription.ts +0 -41
  15. package/src/editors/index.ts +0 -1
  16. package/src/index.ts +0 -21
  17. package/src/scenario-control.ts +0 -121
  18. package/src/scenario-instance-subscription.ts +0 -115
  19. package/src/scenario-queue-subscription.ts +0 -88
  20. package/src/scenario-run.ts +0 -219
  21. package/src/scenario-start.ts +0 -102
  22. package/src/scenario-stop.ts +0 -90
  23. package/src/templates/connection-control.ts +0 -17
  24. package/src/templates/connection-state-subscription.ts +0 -17
  25. package/src/templates/data-subscription.ts +0 -17
  26. package/src/templates/index.ts +0 -21
  27. package/src/templates/scenario-control.ts +0 -18
  28. package/src/templates/scenario-instance-subscription.ts +0 -17
  29. package/src/templates/scenario-queue-subscription.ts +0 -17
  30. package/src/templates/scenario-run.ts +0 -17
  31. package/src/templates/scenario-start.ts +0 -17
  32. package/src/templates/scenario-stop.ts +0 -17
  33. package/tsconfig.json +0 -23
  34. package/tsconfig.tsbuildinfo +0 -1
@@ -1,219 +0,0 @@
1
- import gql from 'graphql-tag'
2
-
3
- import { Component, ComponentNature, DataSource, Properties, RectPath, Shape } from '@hatiolab/things-scene'
4
- import { client } from '@operato/graphql'
5
-
6
- import { scenarios } from './client-api'
7
-
8
- const NATURE: ComponentNature = {
9
- mutable: false,
10
- resizable: true,
11
- rotatable: true,
12
- properties: [
13
- {
14
- type: 'select',
15
- label: 'scenario-name',
16
- name: 'scenarioName',
17
- property: {
18
- options: scenarios
19
- }
20
- },
21
- {
22
- type: 'data',
23
- label: 'variables',
24
- name: 'variables'
25
- },
26
- {
27
- type: 'number',
28
- label: 'repeat-interval',
29
- name: 'interval',
30
- placeholder: 'milli-seconds'
31
- },
32
- {
33
- type: 'checkbox',
34
- label: 'run-on-start',
35
- name: 'runOnStart'
36
- },
37
- {
38
- type: 'select',
39
- label: 'mask-on-error',
40
- name: 'maskOnError',
41
- property: {
42
- options: [
43
- {
44
- display: 'none',
45
- value: ''
46
- },
47
- {
48
- display: 'strong-blur',
49
- value: 'blur(4px)'
50
- },
51
- {
52
- display: 'weak-blur',
53
- value: 'blur(2px)'
54
- },
55
- {
56
- display: 'grayscale',
57
- value: 'grayscale(1)'
58
- }
59
- ]
60
- }
61
- }
62
- ],
63
- 'value-property': 'variables',
64
- help: 'scene/component/scenario-run'
65
- }
66
-
67
- export default class ScenarioRun extends DataSource(RectPath(Shape)) {
68
- static _image: HTMLImageElement
69
-
70
- static get image() {
71
- if (!ScenarioRun._image) {
72
- ScenarioRun._image = new Image()
73
- ScenarioRun._image.src = new URL('../icons/symbol-scenario-run.png', import.meta.url).href
74
- }
75
- return ScenarioRun._image
76
- }
77
-
78
- private _started: boolean = false
79
- private _raf: number = 0
80
- private _timeout: NodeJS.Timeout | null = null
81
-
82
- render(context: CanvasRenderingContext2D) {
83
- var { left, top, width, height } = this.bounds
84
- context.beginPath()
85
- this.drawImage(context, ScenarioRun.image, left, top, width, height)
86
- }
87
-
88
- ready() {
89
- super.ready()
90
-
91
- if (this.app.isViewMode) {
92
- if (this.state.runOnStart) {
93
- this.started = true
94
- }
95
- }
96
- }
97
-
98
- dispose(): void {
99
- this.stop()
100
- super.dispose()
101
- }
102
-
103
- get nature() {
104
- return NATURE
105
- }
106
-
107
- onchange(after: Properties) {
108
- if ('variables' in after) {
109
- this.stop()
110
- this.start()
111
- }
112
- }
113
-
114
- set started(started: boolean) {
115
- this.setState('started')
116
-
117
- if (started) {
118
- this.start()
119
- } else {
120
- this.stop()
121
- }
122
- }
123
-
124
- get started() {
125
- return this.state.started
126
- }
127
-
128
- start() {
129
- if (this._started) {
130
- return
131
- }
132
-
133
- this._started = true
134
-
135
- this._raf = requestAnimationFrame(() => this.requestData())
136
- }
137
-
138
- stop() {
139
- if (!this._started) {
140
- return
141
- }
142
-
143
- this._started = false
144
-
145
- if (this._raf) {
146
- cancelAnimationFrame(this._raf)
147
- this._raf = 0
148
- }
149
- if (this._timeout) {
150
- clearTimeout(this._timeout)
151
- this._timeout = null
152
- }
153
- }
154
-
155
- get variables() {
156
- return this.state.variables
157
- }
158
-
159
- set variables(variables) {
160
- this.setState('variables', variables)
161
- }
162
-
163
- async requestData() {
164
- let { scenarioName, variables, maskOnError } = this.state
165
- if (!scenarioName || !this.app.isViewMode) {
166
- return
167
- }
168
-
169
- try {
170
- variables = typeof variables == 'string' ? JSON.parse(variables) : variables
171
- } catch (e) {
172
- console.warn('runScenario mutation variable is not an object')
173
- }
174
-
175
- if (client) {
176
- try {
177
- var response = await client.query({
178
- query: gql`
179
- mutation ($scenarioName: String!, $variables: Object) {
180
- runScenario(scenarioName: $scenarioName, variables: $variables) {
181
- message
182
- result
183
- }
184
- }
185
- `,
186
- variables: {
187
- scenarioName: scenarioName,
188
- variables
189
- }
190
- })
191
-
192
- this.data = response?.data?.runScenario?.result
193
- this.demask()
194
- } catch (e: any) {
195
- console.error(`calling runScenario mutation error: ${e?.message ?? e}`)
196
- this.mask()
197
- } finally {
198
- if (this._started && this.state.interval > 0) {
199
- this._timeout = setTimeout(() => this.requestData(), this.state.interval)
200
- }
201
- }
202
- }
203
- }
204
-
205
- mask() {
206
- const { maskOnError } = this.state
207
- if (maskOnError) {
208
- //@ts-ignore
209
- this.root?.target_element?.style.filter = maskOnError
210
- }
211
- }
212
-
213
- demask() {
214
- //@ts-ignore
215
- this.root?.target_element?.style.filter = 'none'
216
- }
217
- }
218
-
219
- Component.register('scenario-run', ScenarioRun)
@@ -1,102 +0,0 @@
1
- import gql from 'graphql-tag'
2
-
3
- import { Component, ComponentNature, DataSource, Properties, RectPath, Shape } from '@hatiolab/things-scene'
4
- import { client } from '@operato/graphql'
5
-
6
- import { scenarios } from './client-api'
7
-
8
- const NATURE: ComponentNature = {
9
- mutable: false,
10
- resizable: true,
11
- rotatable: true,
12
- properties: [
13
- {
14
- type: 'string',
15
- label: 'instance-name',
16
- name: 'instanceName'
17
- },
18
- {
19
- type: 'select',
20
- label: 'scenario-name',
21
- name: 'scenarioName',
22
- property: {
23
- options: scenarios
24
- }
25
- },
26
- {
27
- type: 'data',
28
- label: 'variables',
29
- name: 'variables'
30
- }
31
- ],
32
- 'value-property': 'variables',
33
- help: 'scene/component/scenario-start'
34
- }
35
-
36
- export default class ScenarioStart extends DataSource(RectPath(Shape)) {
37
- static _image: HTMLImageElement
38
-
39
- static get image() {
40
- if (!ScenarioStart._image) {
41
- ScenarioStart._image = new Image()
42
- ScenarioStart._image.src = new URL('../icons/symbol-scenario-start.png', import.meta.url).href
43
- }
44
- return ScenarioStart._image
45
- }
46
-
47
- render(context: CanvasRenderingContext2D) {
48
- var { left, top, width, height } = this.bounds
49
- context.beginPath()
50
- this.drawImage(context, ScenarioStart.image, left, top, width, height)
51
- }
52
-
53
- get nature() {
54
- return NATURE
55
- }
56
-
57
- async onchange(after: Properties) {
58
- if ('variables' in after) {
59
- this.requestData()
60
- }
61
- }
62
-
63
- get variables() {
64
- return this.state.variables
65
- }
66
-
67
- set variables(variables) {
68
- this.setState('variables', variables)
69
- }
70
-
71
- async requestData() {
72
- let { instanceName, scenarioName, variables } = this.state
73
- if (!scenarioName || !this.app.isViewMode) return
74
-
75
- try {
76
- variables = typeof variables == 'string' ? JSON.parse(variables) : variables
77
- } catch (e) {
78
- console.error(e)
79
- }
80
-
81
- if (client) {
82
- var response = await client.query({
83
- query: gql`
84
- mutation ($instanceName: String, $scenarioName: String!, $variables: Object) {
85
- startScenario(instanceName: $instanceName, scenarioName: $scenarioName, variables: $variables) {
86
- state
87
- }
88
- }
89
- `,
90
- variables: {
91
- instanceName: instanceName,
92
- scenarioName: scenarioName,
93
- variables
94
- }
95
- })
96
-
97
- this.data = response?.data?.startScenario?.state
98
- }
99
- }
100
- }
101
-
102
- Component.register('scenario-start', ScenarioStart)
@@ -1,90 +0,0 @@
1
- import gql from 'graphql-tag'
2
-
3
- import { Component, ComponentNature, DataSource, Properties, RectPath, Shape } from '@hatiolab/things-scene'
4
- import { client } from '@operato/graphql'
5
-
6
- import { scenarios } from './client-api'
7
-
8
- const NATURE: ComponentNature = {
9
- mutable: false,
10
- resizable: true,
11
- rotatable: true,
12
- properties: [
13
- {
14
- type: 'string',
15
- label: 'instance-name',
16
- name: 'instanceName'
17
- },
18
- {
19
- type: 'select',
20
- label: 'scenario-name',
21
- name: 'scenarioName',
22
- property: {
23
- options: scenarios
24
- }
25
- }
26
- ],
27
- 'value-property': 'nothing',
28
- help: 'scene/component/scenario-stop'
29
- }
30
-
31
- export default class ScenarioStop extends DataSource(RectPath(Shape)) {
32
- static _image: HTMLImageElement
33
-
34
- static get image() {
35
- if (!ScenarioStop._image) {
36
- ScenarioStop._image = new Image()
37
- ScenarioStop._image.src = new URL('../icons/symbol-scenario-stop.png', import.meta.url).href
38
- }
39
- return ScenarioStop._image
40
- }
41
-
42
- render(context: CanvasRenderingContext2D) {
43
- var { left, top, width, height } = this.bounds
44
- context.beginPath()
45
- this.drawImage(context, ScenarioStop.image, left, top, width, height)
46
- }
47
-
48
- get nature() {
49
- return NATURE
50
- }
51
-
52
- onchange(after: Properties) {
53
- if ('nothing' in after) {
54
- this.requestData()
55
- }
56
- }
57
-
58
- get nothing() {
59
- return this.state.nothing
60
- }
61
-
62
- set nothing(nothing) {
63
- this.setState('nothing', nothing)
64
- }
65
-
66
- async requestData() {
67
- let { instanceName, scenarioName } = this.state
68
- instanceName = instanceName || scenarioName
69
- if (!instanceName || !this.app.isViewMode) return
70
-
71
- if (client) {
72
- var response = await client.query({
73
- query: gql`
74
- mutation ($instanceName: String!) {
75
- stopScenario(instanceName: $instanceName) {
76
- state
77
- }
78
- }
79
- `,
80
- variables: {
81
- instanceName: instanceName
82
- }
83
- })
84
-
85
- this.data = response?.data?.stopScenario?.state
86
- }
87
- }
88
- }
89
-
90
- Component.register('scenario-stop', ScenarioStop)
@@ -1,17 +0,0 @@
1
- const icon = new URL('../../icons/icon-connection-control.png', import.meta.url).href
2
-
3
- export default {
4
- type: 'connection-control',
5
- description: 'connection-control',
6
- group: 'dataSource',
7
- /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
8
- icon,
9
- model: {
10
- type: 'connection-control',
11
- left: 10,
12
- top: 10,
13
- width: 100,
14
- height: 100,
15
- hidden: true
16
- }
17
- }
@@ -1,17 +0,0 @@
1
- const icon = new URL('../../icons/icon-connection-state-subscription.png', import.meta.url).href
2
-
3
- export default {
4
- type: 'connection-state-subscription',
5
- description: 'connection-state-subscription',
6
- group: 'dataSource',
7
- /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
8
- icon,
9
- model: {
10
- type: 'connection-state-subscription',
11
- left: 10,
12
- top: 10,
13
- width: 100,
14
- height: 100,
15
- hidden: true
16
- }
17
- }
@@ -1,17 +0,0 @@
1
- const icon = new URL('../../icons/icon-data-subscription.png', import.meta.url).href
2
-
3
- export default {
4
- type: 'data-subscription',
5
- description: 'data-subscription',
6
- group: 'dataSource',
7
- /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
8
- icon,
9
- model: {
10
- type: 'data-subscription',
11
- left: 10,
12
- top: 10,
13
- width: 100,
14
- height: 100,
15
- hidden: true
16
- }
17
- }
@@ -1,21 +0,0 @@
1
- import dataSubscription from './data-subscription'
2
- import scenarioControl from './scenario-control'
3
- import scenarioRun from './scenario-run'
4
- import scenarioStart from './scenario-start'
5
- import scenarioStop from './scenario-stop'
6
- import scenarioInstanceSubscription from './scenario-instance-subscription'
7
- import scenarioQueueSubscription from './scenario-queue-subscription'
8
- import connectionStateSubscription from './connection-state-subscription'
9
- import connectionControl from './connection-control'
10
-
11
- export default [
12
- dataSubscription,
13
- scenarioControl,
14
- scenarioRun,
15
- scenarioStart,
16
- scenarioStop,
17
- scenarioInstanceSubscription,
18
- scenarioQueueSubscription,
19
- connectionStateSubscription,
20
- connectionControl
21
- ]
@@ -1,18 +0,0 @@
1
- const icon = new URL('../../icons/icon-scenario-control.png', import.meta.url).href
2
-
3
- export default {
4
- type: 'scenario-control',
5
- description: 'scenario-control',
6
- group: 'dataSource',
7
- /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
8
- icon,
9
- model: {
10
- type: 'scenario-control',
11
- left: 10,
12
- top: 10,
13
- width: 100,
14
- height: 100,
15
- controlType: '',
16
- hidden: true
17
- }
18
- }
@@ -1,17 +0,0 @@
1
- const icon = new URL('../../icons/icon-scenario-queue-subscription.png', import.meta.url).href
2
-
3
- export default {
4
- type: 'scenario-queue-subscription',
5
- description: 'scenario-queue-subscription',
6
- group: 'dataSource',
7
- /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
8
- icon,
9
- model: {
10
- type: 'scenario-queue-subscription',
11
- left: 10,
12
- top: 10,
13
- width: 100,
14
- height: 100,
15
- hidden: true
16
- }
17
- }
@@ -1,17 +0,0 @@
1
- const icon = new URL('../../icons/icon-scenario-instance-subscription.png', import.meta.url).href
2
-
3
- export default {
4
- type: 'scenario-instance-subscription',
5
- description: 'scenario-instance-subscription',
6
- group: 'dataSource',
7
- /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
8
- icon,
9
- model: {
10
- type: 'scenario-instance-subscription',
11
- left: 10,
12
- top: 10,
13
- width: 100,
14
- height: 100,
15
- hidden: true
16
- }
17
- }
@@ -1,17 +0,0 @@
1
- const icon = new URL('../../icons/icon-scenario-run.png', import.meta.url).href
2
-
3
- export default {
4
- type: 'scenario-run',
5
- description: 'scenario-run',
6
- group: 'dataSource',
7
- /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
8
- icon,
9
- model: {
10
- type: 'scenario-run',
11
- left: 10,
12
- top: 10,
13
- width: 100,
14
- height: 100,
15
- hidden: true
16
- }
17
- }
@@ -1,17 +0,0 @@
1
- const icon = new URL('../../icons/icon-scenario-start.png', import.meta.url).href
2
-
3
- export default {
4
- type: 'scenario-start',
5
- description: 'scenario-start',
6
- group: 'dataSource',
7
- /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
8
- icon,
9
- model: {
10
- type: 'scenario-start',
11
- left: 10,
12
- top: 10,
13
- width: 100,
14
- height: 100,
15
- hidden: true
16
- }
17
- }
@@ -1,17 +0,0 @@
1
- const icon = new URL('../../icons/icon-scenario-stop.png', import.meta.url).href
2
-
3
- export default {
4
- type: 'scenario-stop',
5
- description: 'scenario-stop',
6
- group: 'dataSource',
7
- /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
8
- icon,
9
- model: {
10
- type: 'scenario-stop',
11
- left: 10,
12
- top: 10,
13
- width: 100,
14
- height: 100,
15
- hidden: true
16
- }
17
- }
package/tsconfig.json DELETED
@@ -1,23 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2018",
4
- "module": "esnext",
5
- "moduleResolution": "node",
6
- "noEmitOnError": true,
7
- "lib": ["es2019", "dom"],
8
- "strict": true,
9
- "esModuleInterop": false,
10
- "allowJs": true,
11
- "allowSyntheticDefaultImports": true,
12
- "experimentalDecorators": true,
13
- "importHelpers": true,
14
- "outDir": "dist",
15
- "sourceMap": true,
16
- "inlineSources": true,
17
- "rootDir": "src",
18
- "declaration": true,
19
- "incremental": true,
20
- "skipLibCheck": true
21
- },
22
- "include": ["**/*.ts", "*.d.ts"]
23
- }