@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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@operato/scene-integration",
3
3
  "description": "Things factory integration component for things-scene",
4
- "version": "0.0.26",
4
+ "version": "0.1.3",
5
5
  "license": "MIT",
6
6
  "author": "heartyoh",
7
7
  "main": "dist/index.js",
@@ -27,15 +27,15 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@apollo/client": "^3.5.6",
30
- "@hatiolab/things-scene": "^2.7.31",
30
+ "@hatiolab/things-scene": "^2.7.33",
31
31
  "graphql-tag": "^2.12.6",
32
32
  "subscriptions-transport-ws": "^0.11.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@hatiolab/prettier-config": "^1.0.0",
36
- "@operato/board": "^0.3.1",
37
- "@things-factory/builder": "^4.0.26",
38
- "@things-factory/operato-board": "^4.0.26",
36
+ "@operato/board": "^0.3.20",
37
+ "@things-factory/builder": "^4.0.38",
38
+ "@things-factory/operato-board": "^4.0.38",
39
39
  "@typescript-eslint/eslint-plugin": "^4.33.0",
40
40
  "@typescript-eslint/parser": "^4.33.0",
41
41
  "@web/dev-server": "^0.1.28",
@@ -60,5 +60,5 @@
60
60
  "prettier --write"
61
61
  ]
62
62
  },
63
- "gitHead": "f344a223fc2cd34a5f47e18558b20eb94ca0cea1"
63
+ "gitHead": "f3275af95afaf8389224e1e507df6155cbf39382"
64
64
  }
@@ -0,0 +1,25 @@
1
+ import gql from 'graphql-tag'
2
+
3
+ import { getClient } from './origin-client'
4
+
5
+ export const scenarios = async () => {
6
+ var response = await getClient().query({
7
+ query: gql`
8
+ query {
9
+ scenarios {
10
+ items {
11
+ name
12
+ }
13
+ }
14
+ }
15
+ `
16
+ })
17
+ if (response.errors) {
18
+ return ['']
19
+ }
20
+
21
+ const items = response.data.scenarios.items.map((item: any) => item.name)
22
+ const sorted = items.sort()
23
+
24
+ return [''].concat(sorted)
25
+ }
@@ -1,8 +1,8 @@
1
+ import gql from 'graphql-tag'
2
+
1
3
  import { Component, RectPath, Shape } from '@hatiolab/things-scene'
2
4
 
3
- import COMPONENT_IMAGE from '../assets/symbol-connection-control.png'
4
5
  import { getClient } from './origin-client'
5
- import gql from 'graphql-tag'
6
6
 
7
7
  const NATURE = {
8
8
  mutable: false,
@@ -66,7 +66,7 @@ export default class ConnectionControl extends RectPath(Shape) {
66
66
  static get image() {
67
67
  if (!ConnectionControl._image) {
68
68
  ConnectionControl._image = new Image()
69
- ConnectionControl._image.src = COMPONENT_IMAGE
69
+ ConnectionControl._image.src = new URL('../icons/symbol-connection-control.png', import.meta.url).href
70
70
  }
71
71
  return ConnectionControl._image
72
72
  }
@@ -1,8 +1,8 @@
1
+ import gql from 'graphql-tag'
2
+
1
3
  import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene'
2
- import { getClient, subscribe } from './origin-client'
3
4
 
4
- import COMPONENT_IMAGE from '../assets/symbol-connection-state-subscription.png'
5
- import gql from 'graphql-tag'
5
+ import { getClient, subscribe } from './origin-client'
6
6
 
7
7
  const NATURE = {
8
8
  mutable: false,
@@ -43,7 +43,10 @@ export default class ConnectionStateSubscription extends DataSource(RectPath(Sha
43
43
  static get image() {
44
44
  if (!ConnectionStateSubscription._image) {
45
45
  ConnectionStateSubscription._image = new Image()
46
- ConnectionStateSubscription._image.src = COMPONENT_IMAGE
46
+ ConnectionStateSubscription._image.src = new URL(
47
+ '../icons/symbol-connection-state-subscription.png',
48
+ import.meta.url
49
+ ).href
47
50
  }
48
51
 
49
52
  return ConnectionStateSubscription._image
@@ -1,7 +1,7 @@
1
+ import gql from 'graphql-tag'
2
+
1
3
  import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene'
2
4
 
3
- import COMPONENT_IMAGE from '../assets/symbol-data-subscription.png'
4
- import gql from 'graphql-tag'
5
5
  import { subscribe } from './origin-client'
6
6
 
7
7
  const NATURE = {
@@ -24,7 +24,7 @@ export default class DataSubscription extends DataSource(RectPath(Shape)) {
24
24
  static get image() {
25
25
  if (!DataSubscription._image) {
26
26
  DataSubscription._image = new Image()
27
- DataSubscription._image.src = COMPONENT_IMAGE
27
+ DataSubscription._image.src = new URL('../icons/symbol-data-subscription.png', import.meta.url).href
28
28
  }
29
29
 
30
30
  return DataSubscription._image
@@ -1,8 +1,9 @@
1
+ import gql from 'graphql-tag'
2
+
1
3
  import { Component, DataSource, Properties, RectPath, Shape } from '@hatiolab/things-scene'
2
4
 
3
- import COMPONENT_IMAGE from '../assets/symbol-scenario-control.png'
5
+ import { scenarios } from './client-api'
4
6
  import { getClient } from './origin-client'
5
- import gql from 'graphql-tag'
6
7
 
7
8
  const NATURE = {
8
9
  mutable: false,
@@ -14,24 +15,7 @@ const NATURE = {
14
15
  label: 'scenario-name',
15
16
  name: 'scenarioName',
16
17
  property: {
17
- options: async () => {
18
- var response = await getClient().query({
19
- query: gql`
20
- query {
21
- scenarios {
22
- items {
23
- name
24
- }
25
- }
26
- }
27
- `
28
- })
29
- if (response.errors) {
30
- return ['']
31
- }
32
-
33
- return [''].concat(response.data.scenarios.items.map((item: any) => item.name))
34
- }
18
+ options: scenarios
35
19
  }
36
20
  },
37
21
  {
@@ -66,7 +50,7 @@ export default class ScenarioControl extends DataSource(RectPath(Shape)) {
66
50
  static get image() {
67
51
  if (!ScenarioControl._image) {
68
52
  ScenarioControl._image = new Image()
69
- ScenarioControl._image.src = COMPONENT_IMAGE
53
+ ScenarioControl._image.src = new URL('../icons/symbol-scenario-control.png', import.meta.url).href
70
54
  }
71
55
  return ScenarioControl._image
72
56
  }
@@ -1,8 +1,9 @@
1
+ import gql from 'graphql-tag'
2
+
1
3
  import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene'
2
- import { getClient, subscribe } from './origin-client'
3
4
 
4
- import COMPONENT_IMAGE from '../assets/symbol-scenario-instance-subscription.png'
5
- import gql from 'graphql-tag'
5
+ import { scenarios } from './client-api'
6
+ import { subscribe } from './origin-client'
6
7
 
7
8
  const NATURE = {
8
9
  mutable: false,
@@ -14,24 +15,7 @@ const NATURE = {
14
15
  label: 'scenario-name',
15
16
  name: 'scenarioName',
16
17
  property: {
17
- options: async () => {
18
- var response = await getClient().query({
19
- query: gql`
20
- query {
21
- scenarios {
22
- items {
23
- name
24
- }
25
- }
26
- }
27
- `
28
- })
29
- if (response.errors) {
30
- return ['']
31
- }
32
-
33
- return [''].concat(response.data.scenarios.items.map((item: any) => item.name))
34
- }
18
+ options: scenarios
35
19
  }
36
20
  },
37
21
  {
@@ -49,7 +33,10 @@ export default class ScenarioInstanceSubscription extends DataSource(RectPath(Sh
49
33
  static get image() {
50
34
  if (!ScenarioInstanceSubscription._image) {
51
35
  ScenarioInstanceSubscription._image = new Image()
52
- ScenarioInstanceSubscription._image.src = COMPONENT_IMAGE
36
+ ScenarioInstanceSubscription._image.src = new URL(
37
+ '../icons/symbol-scenario-instance-subscription.png',
38
+ import.meta.url
39
+ ).href
53
40
  }
54
41
 
55
42
  return ScenarioInstanceSubscription._image
@@ -1,7 +1,7 @@
1
+ import gql from 'graphql-tag'
2
+
1
3
  import { Component, DataSource, RectPath, Shape } from '@hatiolab/things-scene'
2
4
 
3
- import COMPONENT_IMAGE from '../assets/symbol-scenario-queue-subscription.png'
4
- import gql from 'graphql-tag'
5
5
  import { subscribe } from './origin-client'
6
6
 
7
7
  const NATURE = {
@@ -18,7 +18,10 @@ export default class ScenarioQueueSubscription extends DataSource(RectPath(Shape
18
18
  static get image() {
19
19
  if (!ScenarioQueueSubscription._image) {
20
20
  ScenarioQueueSubscription._image = new Image()
21
- ScenarioQueueSubscription._image.src = COMPONENT_IMAGE
21
+ ScenarioQueueSubscription._image.src = new URL(
22
+ '../icons/symbol-scenario-queue-subscription.png',
23
+ import.meta.url
24
+ ).href
22
25
  }
23
26
 
24
27
  return ScenarioQueueSubscription._image
@@ -1,8 +1,9 @@
1
+ import gql from 'graphql-tag'
2
+
1
3
  import { Component, DataSource, Properties, RectPath, Shape } from '@hatiolab/things-scene'
2
4
 
3
- import COMPONENT_IMAGE from '../assets/symbol-scenario-run.png'
5
+ import { scenarios } from './client-api'
4
6
  import { getClient } from './origin-client'
5
- import gql from 'graphql-tag'
6
7
 
7
8
  const NATURE = {
8
9
  mutable: false,
@@ -14,24 +15,7 @@ const NATURE = {
14
15
  label: 'scenario-name',
15
16
  name: 'scenarioName',
16
17
  property: {
17
- options: async () => {
18
- var response = await getClient().query({
19
- query: gql`
20
- query {
21
- scenarios {
22
- items {
23
- name
24
- }
25
- }
26
- }
27
- `
28
- })
29
- if (response.errors) {
30
- return ['']
31
- }
32
-
33
- return [''].concat(response.data.scenarios.items.map((item: any) => item.name))
34
- }
18
+ options: scenarios
35
19
  }
36
20
  },
37
21
  {
@@ -55,7 +39,7 @@ export default class ScenarioRun extends DataSource(RectPath(Shape)) {
55
39
  static get image() {
56
40
  if (!ScenarioRun._image) {
57
41
  ScenarioRun._image = new Image()
58
- ScenarioRun._image.src = COMPONENT_IMAGE
42
+ ScenarioRun._image.src = new URL('../icons/symbol-scenario-run.png', import.meta.url).href
59
43
  }
60
44
  return ScenarioRun._image
61
45
  }
@@ -1,8 +1,9 @@
1
+ import gql from 'graphql-tag'
2
+
1
3
  import { Component, DataSource, Properties, RectPath, Shape } from '@hatiolab/things-scene'
2
4
 
3
- import COMPONENT_IMAGE from '../assets/symbol-scenario-start.png'
5
+ import { scenarios } from './client-api'
4
6
  import { getClient } from './origin-client'
5
- import gql from 'graphql-tag'
6
7
 
7
8
  const NATURE = {
8
9
  mutable: false,
@@ -19,24 +20,7 @@ const NATURE = {
19
20
  label: 'scenario-name',
20
21
  name: 'scenarioName',
21
22
  property: {
22
- options: async () => {
23
- var response = await getClient().query({
24
- query: gql`
25
- query {
26
- scenarios {
27
- items {
28
- name
29
- }
30
- }
31
- }
32
- `
33
- })
34
- if (response.errors) {
35
- return ['']
36
- }
37
-
38
- return [''].concat(response.data.scenarios.items.map((item: any) => item.name))
39
- }
23
+ options: scenarios
40
24
  }
41
25
  },
42
26
  {
@@ -55,7 +39,7 @@ export default class ScenarioStart extends DataSource(RectPath(Shape)) {
55
39
  static get image() {
56
40
  if (!ScenarioStart._image) {
57
41
  ScenarioStart._image = new Image()
58
- ScenarioStart._image.src = COMPONENT_IMAGE
42
+ ScenarioStart._image.src = new URL('../icons/symbol-scenario-start.png', import.meta.url).href
59
43
  }
60
44
  return ScenarioStart._image
61
45
  }
@@ -1,8 +1,9 @@
1
+ import gql from 'graphql-tag'
2
+
1
3
  import { Component, DataSource, Properties, RectPath, Shape } from '@hatiolab/things-scene'
2
4
 
3
- import COMPONENT_IMAGE from '../assets/symbol-scenario-stop.png'
5
+ import { scenarios } from './client-api'
4
6
  import { getClient } from './origin-client'
5
- import gql from 'graphql-tag'
6
7
 
7
8
  const NATURE = {
8
9
  mutable: false,
@@ -19,24 +20,7 @@ const NATURE = {
19
20
  label: 'scenario-name',
20
21
  name: 'scenarioName',
21
22
  property: {
22
- options: async () => {
23
- var response = await getClient().query({
24
- query: gql`
25
- query {
26
- scenarios {
27
- items {
28
- name
29
- }
30
- }
31
- }
32
- `
33
- })
34
- if (response.errors) {
35
- return ['']
36
- }
37
-
38
- return [''].concat(response.data.scenarios.items.map((item: any) => item.name))
39
- }
23
+ options: scenarios
40
24
  }
41
25
  }
42
26
  ],
@@ -50,7 +34,7 @@ export default class ScenarioStop extends DataSource(RectPath(Shape)) {
50
34
  static get image() {
51
35
  if (!ScenarioStop._image) {
52
36
  ScenarioStop._image = new Image()
53
- ScenarioStop._image.src = COMPONENT_IMAGE
37
+ ScenarioStop._image.src = new URL('../icons/symbol-scenario-stop.png', import.meta.url).href
54
38
  }
55
39
  return ScenarioStop._image
56
40
  }
@@ -1,4 +1,4 @@
1
- import icon from '../../assets/icon-connection-control.png'
1
+ const icon = new URL('../../icons/icon-connection-control.png', import.meta.url).href
2
2
 
3
3
  export default {
4
4
  type: 'connection-control',
@@ -1,4 +1,4 @@
1
- import icon from '../../assets/icon-connection-state-subscription.png'
1
+ const icon = new URL('../../icons/icon-connection-state-subscription.png', import.meta.url).href
2
2
 
3
3
  export default {
4
4
  type: 'connection-state-subscription',
@@ -1,4 +1,4 @@
1
- import icon from '../../assets/icon-data-subscription.png'
1
+ const icon = new URL('../../icons/icon-data-subscription.png', import.meta.url).href
2
2
 
3
3
  export default {
4
4
  type: 'data-subscription',
@@ -1,4 +1,4 @@
1
- import icon from '../../assets/icon-scenario-control.png'
1
+ const icon = new URL('../../icons/icon-scenario-control.png', import.meta.url).href
2
2
 
3
3
  export default {
4
4
  type: 'scenario-control',
@@ -1,4 +1,4 @@
1
- import icon from '../../assets/icon-scenario-queue-subscription.png'
1
+ const icon = new URL('../../icons/icon-scenario-queue-subscription.png', import.meta.url).href
2
2
 
3
3
  export default {
4
4
  type: 'scenario-queue-subscription',
@@ -1,4 +1,4 @@
1
- import icon from '../../assets/icon-scenario-instance-subscription.png'
1
+ const icon = new URL('../../icons/icon-scenario-instance-subscription.png', import.meta.url).href
2
2
 
3
3
  export default {
4
4
  type: 'scenario-instance-subscription',
@@ -1,4 +1,4 @@
1
- import icon from '../../assets/icon-scenario-run.png'
1
+ const icon = new URL('../../icons/icon-scenario-run.png', import.meta.url).href
2
2
 
3
3
  export default {
4
4
  type: 'scenario-run',
@@ -1,4 +1,4 @@
1
- import icon from '../../assets/icon-scenario-start.png'
1
+ const icon = new URL('../../icons/icon-scenario-start.png', import.meta.url).href
2
2
 
3
3
  export default {
4
4
  type: 'scenario-start',
@@ -1,4 +1,4 @@
1
- import icon from '../../assets/icon-scenario-stop.png'
1
+ const icon = new URL('../../icons/icon-scenario-stop.png', import.meta.url).href
2
2
 
3
3
  export default {
4
4
  type: 'scenario-stop',
package/tsconfig.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "rootDir": "src",
17
17
  "declaration": true,
18
18
  "incremental": true,
19
- "typeRoots": ["./node_modules", "@types"],
19
+ "typeRoots": ["./node_modules"],
20
20
  "types": ["node"]
21
21
  },
22
22
  "include": ["**/*.ts", "*.d.ts"]