@things-factory/integration-base 6.0.125 → 6.0.133

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/integration-base",
3
- "version": "6.0.125",
3
+ "version": "6.0.133",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -26,12 +26,12 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@apollo/client": "^3.6.9",
29
- "@things-factory/api": "^6.0.125",
30
- "@things-factory/auth-base": "^6.0.125",
29
+ "@things-factory/api": "^6.0.133",
30
+ "@things-factory/auth-base": "^6.0.133",
31
31
  "@things-factory/env": "^6.0.124",
32
- "@things-factory/oauth2-client": "^6.0.125",
33
- "@things-factory/scheduler-client": "^6.0.125",
34
- "@things-factory/shell": "^6.0.125",
32
+ "@things-factory/oauth2-client": "^6.0.133",
33
+ "@things-factory/scheduler-client": "^6.0.133",
34
+ "@things-factory/shell": "^6.0.133",
35
35
  "async-mqtt": "^2.5.0",
36
36
  "chance": "^1.1.11",
37
37
  "cross-fetch": "^3.0.4",
@@ -46,5 +46,5 @@
46
46
  "devDependencies": {
47
47
  "@types/cron": "^2.0.1"
48
48
  },
49
- "gitHead": "2d741c0c6ad8cf572560ac5bcc6fb7de470ede72"
49
+ "gitHead": "c08bf83d00cbb66e1338cdfeed8ca91d4e130c97"
50
50
  }
@@ -10,6 +10,7 @@ import './graphql-mutate'
10
10
  import './local-graphql-query'
11
11
  import './local-graphql-mutate'
12
12
  import './sub-scenario'
13
+ import './stop-scenario'
13
14
  import './book-up-scenario'
14
15
  import './pick-pending-scenario'
15
16
  import './reset-pending-queue'
@@ -0,0 +1,43 @@
1
+ import { getRepository } from '@things-factory/shell'
2
+ import { access, deepClone } from '@things-factory/utils'
3
+
4
+ import { Scenario } from '../../service'
5
+ import { ScenarioEngine } from '../../engine'
6
+ import { TaskRegistry } from '../task-registry'
7
+
8
+ async function StopScenario(step, context) {
9
+ var { logger, domain } = context
10
+ var {
11
+ params: { scenario }
12
+ } = step
13
+
14
+ // find the name of the input scenario
15
+ var foundScenario = await getRepository(Scenario).findOne({
16
+ where: {
17
+ id: scenario
18
+ },
19
+ relations: ['steps', 'domain']
20
+ })
21
+
22
+ await ScenarioEngine.unload(domain, foundScenario?.name)
23
+ logger.info(`Scenario '${foundScenario?.name}' is about to be stopped.`)
24
+
25
+ return {
26
+ data: null
27
+ }
28
+ }
29
+
30
+ StopScenario.parameterSpec = [
31
+ {
32
+ type: 'entity-selector',
33
+ name: 'scenario',
34
+ label: 'scenario',
35
+ property: {
36
+ queryName: 'scenarios'
37
+ }
38
+ }
39
+ ]
40
+
41
+ StopScenario.connectorFree = true
42
+
43
+ TaskRegistry.registerTaskHandler('scenario-stop', StopScenario)
@@ -0,0 +1,6 @@
1
+ {
2
+ "error.scenario not found": "シナリオ'{scenario}'が見つかりません.",
3
+ "error.schedule is not set": "スケジュールとして登録するためにはシナリオ'{scenario}'にスケジュール情報が設定される必要があります.",
4
+ "error.timezone is not set": "スケジュールとして登録するためにはシナリオ'{scenario}'にタイム ゾーン情報が設定される必要があります.",
5
+ "error.scenario instance not found": "シナリオ インスタンス'{instance}'が見つかりません. 既に終了している可能性があります."
6
+ }