@things-factory/integration-base 6.4.1 → 6.4.5

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.4.1",
3
+ "version": "6.4.5",
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.4.1",
30
- "@things-factory/auth-base": "^6.4.1",
29
+ "@things-factory/api": "^6.4.5",
30
+ "@things-factory/auth-base": "^6.4.5",
31
31
  "@things-factory/env": "^6.3.0",
32
- "@things-factory/oauth2-client": "^6.4.1",
33
- "@things-factory/scheduler-client": "^6.4.1",
34
- "@things-factory/shell": "^6.4.1",
32
+ "@things-factory/oauth2-client": "^6.4.5",
33
+ "@things-factory/scheduler-client": "^6.4.5",
34
+ "@things-factory/shell": "^6.4.2",
35
35
  "@things-factory/utils": "^6.3.1",
36
36
  "async-mqtt": "^2.5.0",
37
37
  "chance": "^1.1.11",
@@ -46,5 +46,5 @@
46
46
  "devDependencies": {
47
47
  "@types/cron": "^2.0.1"
48
48
  },
49
- "gitHead": "47ea4ab312b1d23a146e4d2048972b39af6592fa"
49
+ "gitHead": "df6e9fd7de8564e0ffc7b81221bf2f6afa1fabad"
50
50
  }
@@ -9,7 +9,10 @@ import { Connection, ConnectionPatch, ConnectionStatus, NewConnection } from './
9
9
  @Resolver(Connection)
10
10
  export class ConnectionMutation {
11
11
  @Directive('@transaction')
12
- @Mutation(returns => Connection, { description: 'To create new connection' })
12
+ @Directive(
13
+ '@privilege(category: "connection", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'
14
+ )
15
+ @Mutation(returns => Connection, { description: 'To create new connection' })
13
16
  async createConnection(
14
17
  @Arg('connection') connection: NewConnection,
15
18
  @Ctx() context: ResolverContext
@@ -25,7 +28,10 @@ export class ConnectionMutation {
25
28
  }
26
29
 
27
30
  @Directive('@transaction')
28
- @Mutation(returns => Connection, { description: 'To modify connection information' })
31
+ @Directive(
32
+ '@privilege(category: "connection", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'
33
+ )
34
+ @Mutation(returns => Connection, { description: 'To modify connection information' })
29
35
  async updateConnection(
30
36
  @Arg('name') name: string,
31
37
  @Arg('patch') patch: ConnectionPatch,
@@ -46,6 +52,9 @@ export class ConnectionMutation {
46
52
  }
47
53
 
48
54
  @Directive('@transaction')
55
+ @Directive(
56
+ '@privilege(category: "connection", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'
57
+ )
49
58
  @Mutation(returns => [Connection], { description: "To modify multiple connections' information" })
50
59
  async updateMultipleConnection(
51
60
  @Arg('patches', type => [ConnectionPatch]) patches: ConnectionPatch[],
@@ -92,6 +101,9 @@ export class ConnectionMutation {
92
101
  }
93
102
 
94
103
  @Directive('@transaction')
104
+ @Directive(
105
+ '@privilege(category: "connection", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'
106
+ )
95
107
  @Mutation(returns => Boolean, { description: 'To delete connection' })
96
108
  async deleteConnection(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<boolean> {
97
109
  const { domain, tx } = context.state
@@ -101,6 +113,9 @@ export class ConnectionMutation {
101
113
  }
102
114
 
103
115
  @Directive('@transaction')
116
+ @Directive(
117
+ '@privilege(category: "connection", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'
118
+ )
104
119
  @Mutation(returns => Boolean, { description: 'To delete multiple connections' })
105
120
  async deleteConnections(
106
121
  @Arg('names', type => [String]) names: string[],
@@ -116,6 +131,9 @@ export class ConnectionMutation {
116
131
  return true
117
132
  }
118
133
 
134
+ @Directive(
135
+ '@privilege(category: "connection", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'
136
+ )
119
137
  @Mutation(returns => Connection, { description: 'To connect a connection' })
120
138
  async connectConnection(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<Connection> {
121
139
  const { domain } = context.state
@@ -136,6 +154,9 @@ export class ConnectionMutation {
136
154
  } as Connection
137
155
  }
138
156
 
157
+ @Directive(
158
+ '@privilege(category: "connection", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'
159
+ )
139
160
  @Mutation(returns => Connection, { description: 'To disconnect a connection' })
140
161
  async disconnectConnection(@Arg('name') name: string, @Ctx() context: ResolverContext) {
141
162
  const { domain } = context.state
@@ -158,7 +179,9 @@ export class ConnectionMutation {
158
179
  }
159
180
 
160
181
  @Directive('@transaction')
161
- // @Directive('@privilege(category: "connection", privilege: "mutation", domainOwnerGranted: true)')
182
+ @Directive(
183
+ '@privilege(category: "connection", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'
184
+ )
162
185
  @Mutation(returns => Boolean, { description: 'To import multiple connections' })
163
186
  async importConnections(
164
187
  @Arg('connections', type => [ConnectionPatch]) connections: Connection[],
@@ -1,4 +1,4 @@
1
- import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
1
+ import { Arg, Args, Ctx, Directive, FieldResolver, Query, Resolver, Root } from 'type-graphql'
2
2
 
3
3
  import { User } from '@things-factory/auth-base'
4
4
  import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
@@ -8,6 +8,7 @@ import { Connection, ConnectionList, ConnectionState, ConnectionStatus } from '.
8
8
 
9
9
  @Resolver(Connection)
10
10
  export class ConnectionQuery {
11
+ @Directive('@privilege(category: "connection", privilege: "query", domainOwnerGranted: true, superUserGranted: true)')
11
12
  @Query(returns => Connection, { description: 'To fetch a connection' })
12
13
  async connection(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<Connection> {
13
14
  const { domain } = context.state
@@ -25,6 +26,7 @@ export class ConnectionQuery {
25
26
  } as Connection
26
27
  }
27
28
 
29
+ @Directive('@privilege(category: "connection", privilege: "query", domainOwnerGranted: true, superUserGranted: true)')
28
30
  @Query(returns => ConnectionList, { description: 'To fetch multiple connections' })
29
31
  async connections(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ConnectionList> {
30
32
  const { domain } = context.state
@@ -48,6 +50,7 @@ export class ConnectionQuery {
48
50
  return { items, total }
49
51
  }
50
52
 
53
+ @Directive('@privilege(category: "connection", privilege: "query", domainOwnerGranted: true, superUserGranted: true)')
51
54
  @Query(returns => ConnectionState, { description: 'To fetch the state of a connection' })
52
55
  fetchConnectionState(@Arg('name') name: string, @Ctx() context: ResolverContext): ConnectionState {
53
56
  const { domain } = context.state