@things-factory/integration-base 6.2.54 → 6.2.57
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/dist-server/engine/task/state-read.js +1 -1
- package/dist-server/engine/task/state-read.js.map +1 -1
- package/dist-server/routers/scenario-schedule-callback-router.js +5 -4
- package/dist-server/routers/scenario-schedule-callback-router.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/server/engine/task/state-read.ts +1 -1
- package/server/routers/scenario-schedule-callback-router.ts +5 -4
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/integration-base",
|
3
|
-
"version": "6.2.
|
3
|
+
"version": "6.2.57",
|
4
4
|
"main": "dist-server/index.js",
|
5
5
|
"browser": "client/index.js",
|
6
6
|
"things-factory": true,
|
@@ -46,5 +46,5 @@
|
|
46
46
|
"devDependencies": {
|
47
47
|
"@types/cron": "^2.0.1"
|
48
48
|
},
|
49
|
-
"gitHead": "
|
49
|
+
"gitHead": "de09b15757a2bad601a2e23dc52f16b0d816a420"
|
50
50
|
}
|
@@ -13,7 +13,7 @@ async function StateRead(step, { logger, publish, data, domain, user, client })
|
|
13
13
|
var { data: queryResult, errors } = await client.query({
|
14
14
|
query: gql`
|
15
15
|
query ($name: String!) {
|
16
|
-
stateRegisterByName(
|
16
|
+
stateRegisterByName(name: $name) {
|
17
17
|
state
|
18
18
|
}
|
19
19
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import Router from 'koa-router'
|
2
2
|
|
3
3
|
import { getRepository } from '@things-factory/shell'
|
4
|
+
import { User } from '@things-factory/auth-base'
|
4
5
|
import { ScheduleRegisterRequest } from '@things-factory/scheduler-client'
|
5
6
|
|
6
7
|
import { Scenario } from '../service/scenario/scenario-type'
|
@@ -10,7 +11,8 @@ export const scenarioScheduleCallbackRouter = new Router()
|
|
10
11
|
|
11
12
|
/* When a callback occurs from the scheduler when a scheduled scenario is on schedule. */
|
12
13
|
scenarioScheduleCallbackRouter.post('/callback-schedule-for-scenario', async (context, next) => {
|
13
|
-
const { client } = context.request.body as ScheduleRegisterRequest
|
14
|
+
const { client, task } = context.request.body as ScheduleRegisterRequest
|
15
|
+
const { userId } = task?.data
|
14
16
|
|
15
17
|
// application: Application,
|
16
18
|
// group: `${domain.id}`,
|
@@ -18,7 +20,7 @@ scenarioScheduleCallbackRouter.post('/callback-schedule-for-scenario', async (co
|
|
18
20
|
// key: scenario.id,
|
19
21
|
// operation: 'start'
|
20
22
|
|
21
|
-
const { domain
|
23
|
+
const { domain } = context.state
|
22
24
|
|
23
25
|
if (!domain) {
|
24
26
|
throw new Error('cannot identify the current domain.')
|
@@ -55,8 +57,7 @@ scenarioScheduleCallbackRouter.post('/callback-schedule-for-scenario', async (co
|
|
55
57
|
throw new Error(`Scenario having given scenarioId(${domain?.subdomain}:${scenarioId}) not found`)
|
56
58
|
}
|
57
59
|
|
58
|
-
|
59
|
-
context.state.user = scenario.creator
|
60
|
+
const user = (userId && (await getRepository(User).findOne({ where: { id: userId } }))) || scenario.creator
|
60
61
|
|
61
62
|
ScenarioEngine.load(scenario.name, scenario, {
|
62
63
|
domain,
|