@things-factory/integration-base 6.1.155 → 6.1.156
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 +17 -1
- package/dist-server/service/connection/connection-mutation.js.map +1 -1
- package/dist-server/service/scenario/scenario-mutation.js +26 -7
- 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 +31 -2
- package/server/service/scenario/scenario-mutation.ts +51 -16
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.156",
|
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.156",
|
30
|
+
"@things-factory/auth-base": "^6.1.156",
|
31
31
|
"@things-factory/env": "^6.1.154",
|
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.156",
|
33
|
+
"@things-factory/scheduler-client": "^6.1.156",
|
34
|
+
"@things-factory/shell": "^6.1.156",
|
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": "5a0f1cd16edee089468c231b3bb97bd0c03c8727"
|
50
50
|
}
|
@@ -166,12 +166,41 @@ export class ConnectionMutation {
|
|
166
166
|
): Promise<boolean> {
|
167
167
|
const { tx, domain, user } = context.state
|
168
168
|
|
169
|
+
const repository = tx.getRepository(Connection)
|
170
|
+
|
169
171
|
await Promise.all(
|
170
172
|
connections.map(async (connection: Connection) => {
|
171
|
-
|
173
|
+
const { id, name } = connection
|
174
|
+
|
175
|
+
if (id) {
|
176
|
+
const sameId = await repository.findOneBy({ id })
|
177
|
+
|
178
|
+
if (sameId) {
|
179
|
+
if (sameId.domainId != domain.id) {
|
180
|
+
throw `Connection with id '${id}:${name}' is already taken by another domain`
|
181
|
+
}
|
182
|
+
|
183
|
+
const sameName = await repository.findOneBy({ domain: { id: domain.id }, name })
|
184
|
+
if (sameName && sameName.id != id) {
|
185
|
+
throw `Connection with name '${name}' is already taken by another connection`
|
186
|
+
}
|
187
|
+
|
188
|
+
await repository.save({
|
189
|
+
...sameId,
|
190
|
+
...connection,
|
191
|
+
domain,
|
192
|
+
updater: user
|
193
|
+
})
|
194
|
+
|
195
|
+
return
|
196
|
+
}
|
197
|
+
}
|
198
|
+
|
199
|
+
await repository.save({
|
172
200
|
...connection,
|
173
201
|
domain,
|
174
|
-
updater: user
|
202
|
+
updater: user,
|
203
|
+
creator: user
|
175
204
|
})
|
176
205
|
})
|
177
206
|
)
|
@@ -147,27 +147,62 @@ export class ScenarioMutation {
|
|
147
147
|
@Arg('scenarios', type => [ScenarioPatch]) scenarios: Scenario[],
|
148
148
|
@Ctx() context: ResolverContext
|
149
149
|
): Promise<boolean> {
|
150
|
-
const { domain, user
|
150
|
+
const { tx, domain, user } = context.state
|
151
|
+
|
152
|
+
const repository = tx.getRepository(Scenario)
|
151
153
|
|
152
154
|
await Promise.all(
|
153
155
|
scenarios.map(async (scenario: Scenario) => {
|
154
|
-
const
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
}
|
156
|
+
const { id, name } = scenario
|
157
|
+
var savedScenario
|
158
|
+
|
159
|
+
if (id) {
|
160
|
+
const sameId = await repository.findOneBy({ id })
|
161
|
+
|
162
|
+
if (sameId) {
|
163
|
+
if (sameId.domainId != domain.id) {
|
164
|
+
throw `Scenario with id '${id}:${name}' is already taken by another domain`
|
165
|
+
}
|
166
|
+
|
167
|
+
const sameName = await repository.findOneBy({ domain: { id: domain.id }, name })
|
168
|
+
if (sameName && sameName.id != id) {
|
169
|
+
throw `Scenario Name '${name}' is already taken by another scenario`
|
170
|
+
}
|
171
|
+
|
172
|
+
savedScenario = await repository.save({
|
173
|
+
...sameId,
|
174
|
+
...scenario,
|
175
|
+
domain,
|
176
|
+
updater: user
|
177
|
+
})
|
178
|
+
} else {
|
179
|
+
savedScenario = await repository.save({
|
180
|
+
...scenario,
|
181
|
+
domain,
|
182
|
+
updater: user,
|
183
|
+
creator: user
|
168
184
|
})
|
169
|
-
|
185
|
+
}
|
186
|
+
} else {
|
187
|
+
savedScenario = await repository.save({
|
188
|
+
...scenario,
|
189
|
+
domain,
|
190
|
+
updater: user,
|
191
|
+
creator: user
|
192
|
+
})
|
170
193
|
}
|
194
|
+
|
195
|
+
await tx.getRepository(Step).delete({ domain: { id: domain.id }, scenario: { id: savedScenario.id } })
|
196
|
+
await tx.getRepository(Step).save(
|
197
|
+
scenario.steps.map((step: Step) => {
|
198
|
+
return {
|
199
|
+
...step,
|
200
|
+
domain,
|
201
|
+
scenario: savedScenario,
|
202
|
+
updater: user
|
203
|
+
}
|
204
|
+
})
|
205
|
+
)
|
171
206
|
})
|
172
207
|
)
|
173
208
|
|