@spytecgps/nova-orm 1.4.80 → 1.4.81

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.
@@ -1,5 +1,5 @@
1
1
  import { MigrationInterface, QueryRunner } from 'typeorm';
2
- export declare class createUserAuthorizedDeviceSecurityViewV21684483706000 implements MigrationInterface {
2
+ export declare class updateSecurityUserViews1684483705000 implements MigrationInterface {
3
3
  up(queryRunner: QueryRunner): Promise<void>;
4
4
  down(queryRunner: QueryRunner): Promise<void>;
5
5
  }
@@ -1,9 +1,70 @@
1
1
  'use strict';
2
2
 
3
- class createUserAuthorizedBoundarySecurityViewV21684483705000 {
3
+ class updateSecurityUserViews1684483705000 {
4
4
  async up(queryRunner) {
5
5
  await queryRunner.query(`
6
- CREATE OR REPLACE VIEW \`user_authorized_boundary_security_view_v2\` AS
6
+ CREATE OR REPLACE VIEW \`user_authorized_device_security_view\` AS
7
+ (
8
+ SELECT
9
+ d.clientId AS clientId,
10
+ d.imei AS imei,
11
+ usr.userId AS userId
12
+ FROM userSecurityRole usr
13
+ JOIN device d
14
+ ON d.clientId = usr.clientId
15
+ WHERE usr.access = 'full'
16
+ AND NOT EXISTS (
17
+ SELECT 1
18
+ FROM entityTag ut
19
+ WHERE ut.userId = usr.userId
20
+ AND ut.entityType = 'User'
21
+ AND ut.isSecurityGroup = 1
22
+ )
23
+ )
24
+ UNION
25
+ (
26
+ SELECT
27
+ d.clientId AS clientId,
28
+ d.imei AS imei,
29
+ usr.userId AS userId
30
+ FROM entityTag ut
31
+ JOIN entityTag rt
32
+ ON rt.tagId = ut.tagId
33
+ AND rt.entityType = 'Device'
34
+ AND rt.isSecurityGroup = 1
35
+ JOIN device d
36
+ ON d.imei = rt.imei
37
+ JOIN userSecurityRole usr
38
+ ON usr.userId = ut.userId
39
+ AND usr.clientId = d.clientId
40
+ WHERE ut.entityType = 'User'
41
+ AND ut.isSecurityGroup = 1
42
+ )
43
+ UNION (
44
+ SELECT
45
+ uad.clientId AS clientId,
46
+ uad.imei AS imei,
47
+ uad.userId AS userId
48
+ FROM userAuthorizedDevice uad
49
+ WHERE NOT EXISTS (
50
+ SELECT 1
51
+ FROM userSecurityRole usr
52
+ WHERE usr.clientId = uad.clientId
53
+ AND usr.userId = uad.userId
54
+ AND usr.access = 'full'
55
+ )
56
+ AND NOT EXISTS (
57
+ SELECT 1
58
+ FROM entityTag ut
59
+ WHERE ut.clientId = uad.clientId
60
+ AND ut.userId = uad.userId
61
+ AND ut.entityType = 'User'
62
+ AND ut.isSecurityGroup = 1
63
+ )
64
+ );
65
+ `);
66
+ await queryRunner.query(`
67
+ CREATE OR REPLACE VIEW \`user_authorized_boundary_security_view\` AS
7
68
  (
8
69
  SELECT
9
70
  b.clientId AS clientId,
@@ -66,10 +127,11 @@ class createUserAuthorizedBoundarySecurityViewV21684483705000 {
66
127
  `);
67
128
  }
68
129
  async down(queryRunner) {
130
+ await queryRunner.query(`DROP VIEW IF EXISTS \`user_authorized_device_security_view\`;`);
69
131
  await queryRunner.query(`
70
- DROP VIEW IF EXISTS \`user_authorized_boundary_security_view_v2\`;
132
+ DROP VIEW IF EXISTS \`user_authorized_boundary_security_view\`;
71
133
  `);
72
134
  }
73
135
  }
74
136
 
75
- exports.createUserAuthorizedBoundarySecurityViewV21684483705000 = createUserAuthorizedBoundarySecurityViewV21684483705000;
137
+ exports.updateSecurityUserViews1684483705000 = updateSecurityUserViews1684483705000;
@@ -1,11 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var _1684483704434AddLowerCaseIndex = require('../1684483704434-addLowerCaseIndex.js');
4
- var _1684483706000CreateUserAuthorizedDeviceSecurityViewV2 = require('../1684483706000-createUserAuthorizedDeviceSecurityViewV2.js');
5
- var _1684483705000CreateUserAuthorizedBoundarySecurityViewV2 = require('../1684483705000-createUserAuthorizedBoundarySecurityViewV2.js');
4
+ var _1684483705000UpdateSecurityUserViews = require('../1684483705000-updateSecurityUserViews.js');
6
5
 
7
6
 
8
7
 
9
8
  exports.addLowerCaseIndex1684483704434 = _1684483704434AddLowerCaseIndex.addLowerCaseIndex1684483704434;
10
- exports.createUserAuthorizedDeviceSecurityViewV21684483706000 = _1684483706000CreateUserAuthorizedDeviceSecurityViewV2.createUserAuthorizedDeviceSecurityViewV21684483706000;
11
- exports.createUserAuthorizedBoundarySecurityViewV21684483705000 = _1684483705000CreateUserAuthorizedBoundarySecurityViewV2.createUserAuthorizedBoundarySecurityViewV21684483705000;
9
+ exports.updateSecurityUserViews1684483705000 = _1684483705000UpdateSecurityUserViews.updateSecurityUserViews1684483705000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/nova-orm",
3
- "version": "1.4.80",
3
+ "version": "1.4.81",
4
4
  "description": "ORM with PlanetScale",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,5 +0,0 @@
1
- export declare class UserAuthorizedBoundarySecurityViewV2 {
2
- clientId: number;
3
- userId: string;
4
- boundaryId: number;
5
- }
@@ -1,5 +0,0 @@
1
- export declare class UserAuthorizedDeviceSecurityViewV2 {
2
- clientId: number;
3
- imei: string;
4
- userId: string;
5
- }
@@ -1,5 +0,0 @@
1
- import { MigrationInterface, QueryRunner } from 'typeorm';
2
- export declare class createUserAuthorizedBoundarySecurityViewV21684483705000 implements MigrationInterface {
3
- up(queryRunner: QueryRunner): Promise<void>;
4
- down(queryRunner: QueryRunner): Promise<void>;
5
- }
@@ -1,72 +0,0 @@
1
- 'use strict';
2
-
3
- class createUserAuthorizedDeviceSecurityViewV21684483706000 {
4
- async up(queryRunner) {
5
- await queryRunner.query(`
6
- CREATE OR REPLACE VIEW \`user_authorized_device_security_view_v2\` AS
7
- (
8
- SELECT
9
- d.clientId AS clientId,
10
- d.imei AS imei,
11
- usr.userId AS userId
12
- FROM userSecurityRole usr
13
- JOIN device d
14
- ON d.clientId = usr.clientId
15
- WHERE usr.access = 'full'
16
- AND NOT EXISTS (
17
- SELECT 1
18
- FROM entityTag ut
19
- WHERE ut.userId = usr.userId
20
- AND ut.entityType = 'User'
21
- AND ut.isSecurityGroup = 1
22
- )
23
- )
24
- UNION
25
- (
26
- SELECT
27
- d.clientId AS clientId,
28
- d.imei AS imei,
29
- usr.userId AS userId
30
- FROM entityTag ut
31
- JOIN entityTag rt
32
- ON rt.tagId = ut.tagId
33
- AND rt.entityType = 'Device'
34
- AND rt.isSecurityGroup = 1
35
- JOIN device d
36
- ON d.imei = rt.imei
37
- JOIN userSecurityRole usr
38
- ON usr.userId = ut.userId
39
- AND usr.clientId = d.clientId
40
- WHERE ut.entityType = 'User'
41
- AND ut.isSecurityGroup = 1
42
- )
43
- UNION (
44
- SELECT
45
- uad.clientId AS clientId,
46
- uad.imei AS imei,
47
- uad.userId AS userId
48
- FROM userAuthorizedDevice uad
49
- WHERE NOT EXISTS (
50
- SELECT 1
51
- FROM userSecurityRole usr
52
- WHERE usr.clientId = uad.clientId
53
- AND usr.userId = uad.userId
54
- AND usr.access = 'full'
55
- )
56
- AND NOT EXISTS (
57
- SELECT 1
58
- FROM entityTag ut
59
- WHERE ut.clientId = uad.clientId
60
- AND ut.userId = uad.userId
61
- AND ut.entityType = 'User'
62
- AND ut.isSecurityGroup = 1
63
- )
64
- );
65
- `);
66
- }
67
- async down(queryRunner) {
68
- await queryRunner.query(`DROP VIEW IF EXISTS \`user_authorized_device_security_view_v2\`;`);
69
- }
70
- }
71
-
72
- exports.createUserAuthorizedDeviceSecurityViewV21684483706000 = createUserAuthorizedDeviceSecurityViewV21684483706000;