@things-factory/integration-base 6.1.146 → 6.1.152
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/service/connection/connection-mutation.js +18 -0
- package/dist-server/service/connection/connection-mutation.js.map +1 -1
- package/dist-server/service/connection/connection-type.js +1 -1
- package/dist-server/service/connection/connection-type.js.map +1 -1
- package/dist-server/service/scenario/scenario-mutation.js +3 -6
- package/dist-server/service/scenario/scenario-mutation.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/server/service/connection/connection-mutation.ts +22 -0
- package/server/service/connection/connection-type.ts +2 -2
- package/server/service/scenario/scenario-mutation.ts +13 -6
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/integration-base",
|
3
|
-
"version": "6.1.
|
3
|
+
"version": "6.1.152",
|
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.1.
|
30
|
-
"@things-factory/auth-base": "^6.1.
|
29
|
+
"@things-factory/api": "^6.1.152",
|
30
|
+
"@things-factory/auth-base": "^6.1.152",
|
31
31
|
"@things-factory/env": "^6.1.145",
|
32
|
-
"@things-factory/oauth2-client": "^6.1.
|
33
|
-
"@things-factory/scheduler-client": "^6.1.
|
34
|
-
"@things-factory/shell": "^6.1.
|
32
|
+
"@things-factory/oauth2-client": "^6.1.152",
|
33
|
+
"@things-factory/scheduler-client": "^6.1.152",
|
34
|
+
"@things-factory/shell": "^6.1.152",
|
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": "
|
49
|
+
"gitHead": "9d0c8827cb25f037bcb4270ea53dcd95f73b2722"
|
50
50
|
}
|
@@ -156,4 +156,26 @@ export class ConnectionMutation {
|
|
156
156
|
: ConnectionStatus.DISCONNECTED
|
157
157
|
}
|
158
158
|
}
|
159
|
+
|
160
|
+
@Directive('@transaction')
|
161
|
+
// @Directive('@privilege(category: "connection", privilege: "mutation", domainOwnerGranted: true)')
|
162
|
+
@Mutation(returns => Boolean, { description: 'To import multiple connections' })
|
163
|
+
async importConnections(
|
164
|
+
@Arg('connections', type => [ConnectionPatch]) connections: Connection[],
|
165
|
+
@Ctx() context: ResolverContext
|
166
|
+
): Promise<boolean> {
|
167
|
+
const { tx, domain, user } = context.state
|
168
|
+
|
169
|
+
await Promise.all(
|
170
|
+
connections.map(async (connection: Connection) => {
|
171
|
+
await tx.getRepository(Connection).save({
|
172
|
+
...connection,
|
173
|
+
domain,
|
174
|
+
updater: user
|
175
|
+
})
|
176
|
+
})
|
177
|
+
)
|
178
|
+
|
179
|
+
return true
|
180
|
+
}
|
159
181
|
}
|
@@ -147,17 +147,24 @@ export class ScenarioMutation {
|
|
147
147
|
@Arg('scenarios', type => [ScenarioPatch]) scenarios: Scenario[],
|
148
148
|
@Ctx() context: ResolverContext
|
149
149
|
): Promise<boolean> {
|
150
|
-
const tx
|
151
|
-
|
150
|
+
const { domain, user, tx } = context.state
|
151
|
+
|
152
152
|
await Promise.all(
|
153
153
|
scenarios.map(async (scenario: Scenario) => {
|
154
|
-
const
|
154
|
+
const savedScenario: Scenario = await tx.getRepository(Scenario).save({
|
155
|
+
domain,
|
156
|
+
...scenario,
|
157
|
+
updater: user
|
158
|
+
})
|
155
159
|
if (scenario.steps?.length) {
|
156
160
|
await tx.getRepository(Step).save(
|
157
161
|
scenario.steps.map((step: Step) => {
|
158
|
-
|
159
|
-
|
160
|
-
|
162
|
+
return {
|
163
|
+
...step,
|
164
|
+
domain,
|
165
|
+
scenario: savedScenario,
|
166
|
+
updater: user
|
167
|
+
}
|
161
168
|
})
|
162
169
|
)
|
163
170
|
}
|