@spytecgps/nova-orm 1.4.84 → 1.4.86
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/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/migration/{1684483705000-updateSecurityUserViews.d.ts → 1684483705001-updateSecurityUserViewsV1.d.ts} +1 -1
- package/dist/migration/{1684483705000-updateSecurityUserViews.js → 1684483705001-updateSecurityUserViewsV1.js} +24 -20
- package/dist/migration/1684483705002-updateSecurityUserViewsV2.d.ts +5 -0
- package/dist/migration/1684483705002-updateSecurityUserViewsV2.js +144 -0
- package/dist/migration/_virtual/_virtual_multi-entry.js +4 -2
- package/dist/types/enums.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
-
export declare class
|
|
2
|
+
export declare class updateSecurityUserViewsV11684483705001 implements MigrationInterface {
|
|
3
3
|
up(queryRunner: QueryRunner): Promise<void>;
|
|
4
4
|
down(queryRunner: QueryRunner): Promise<void>;
|
|
5
5
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
class
|
|
3
|
+
class updateSecurityUserViewsV11684483705001 {
|
|
4
4
|
async up(queryRunner) {
|
|
5
5
|
await queryRunner.query(`
|
|
6
|
-
CREATE OR REPLACE VIEW \`
|
|
6
|
+
CREATE OR REPLACE VIEW \`user_authorized_device_security_view\` AS
|
|
7
7
|
(
|
|
8
8
|
SELECT
|
|
9
9
|
d.clientId AS clientId,
|
|
@@ -28,18 +28,20 @@ class updateSecurityUserViews1684483705000 {
|
|
|
28
28
|
d.clientId AS clientId,
|
|
29
29
|
d.imei AS imei,
|
|
30
30
|
usr.userId AS userId
|
|
31
|
-
FROM entityTag ut
|
|
31
|
+
FROM entityTag ut USE INDEX (ixEntityTagClientIdUserIdEntityTypeIsSecurityGroupTagId)
|
|
32
32
|
JOIN entityTag rt USE INDEX (ixEntityTagImeiIsSecurityGroupTagId)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
ON d.imei = rt.imei
|
|
33
|
+
ON rt.tagId = ut.tagId
|
|
34
|
+
AND rt.entityType = 'Device'
|
|
35
|
+
AND rt.isSecurityGroup = 1
|
|
36
|
+
AND rt.clientId = ut.clientId
|
|
38
37
|
JOIN userSecurityRole usr USE INDEX (ixUserSecurityRoleClientIdAccessUserId)
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
ON usr.clientId = rt.clientId
|
|
39
|
+
AND usr.userId = ut.userId
|
|
40
|
+
JOIN device d USE INDEX (ixDeviceClientIdImei)
|
|
41
|
+
ON d.clientId = rt.clientId
|
|
42
|
+
AND d.imei = rt.imei
|
|
41
43
|
WHERE ut.entityType = 'User'
|
|
42
|
-
|
|
44
|
+
AND ut.isSecurityGroup = 1
|
|
43
45
|
)
|
|
44
46
|
UNION ALL
|
|
45
47
|
(
|
|
@@ -66,7 +68,7 @@ class updateSecurityUserViews1684483705000 {
|
|
|
66
68
|
);
|
|
67
69
|
`);
|
|
68
70
|
await queryRunner.query(`
|
|
69
|
-
CREATE OR REPLACE VIEW \`
|
|
71
|
+
CREATE OR REPLACE VIEW \`user_authorized_boundary_security_view\` AS
|
|
70
72
|
(
|
|
71
73
|
SELECT
|
|
72
74
|
b.clientId AS clientId,
|
|
@@ -91,16 +93,18 @@ class updateSecurityUserViews1684483705000 {
|
|
|
91
93
|
b.clientId AS clientId,
|
|
92
94
|
usr.userId AS userId,
|
|
93
95
|
b.id AS boundaryId
|
|
94
|
-
FROM entityTag ut
|
|
95
|
-
JOIN entityTag rt
|
|
96
|
+
FROM entityTag ut USE INDEX (ixEntityTagClientIdUserIdEntityTypeIsSecurityGroupTagId)
|
|
97
|
+
JOIN entityTag rt
|
|
96
98
|
ON rt.tagId = ut.tagId
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
AND rt.entityType = 'Boundary'
|
|
100
|
+
AND rt.isSecurityGroup = 1
|
|
101
|
+
AND rt.clientId = ut.clientId
|
|
99
102
|
JOIN boundary b
|
|
100
|
-
ON b.
|
|
103
|
+
ON b.clientId = rt.clientId
|
|
104
|
+
AND b.id = rt.entityId
|
|
101
105
|
JOIN userSecurityRole usr USE INDEX (ixUserSecurityRoleClientIdAccessUserId)
|
|
102
|
-
ON usr.
|
|
103
|
-
|
|
106
|
+
ON usr.clientId = rt.clientId
|
|
107
|
+
AND usr.userId = ut.userId
|
|
104
108
|
WHERE ut.entityType = 'User'
|
|
105
109
|
AND ut.isSecurityGroup = 1
|
|
106
110
|
)
|
|
@@ -137,4 +141,4 @@ class updateSecurityUserViews1684483705000 {
|
|
|
137
141
|
}
|
|
138
142
|
}
|
|
139
143
|
|
|
140
|
-
exports.
|
|
144
|
+
exports.updateSecurityUserViewsV11684483705001 = updateSecurityUserViewsV11684483705001;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class updateSecurityUserViewsV21684483705002 {
|
|
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 USE INDEX (ixUserSecurityRoleClientIdAccessUserId)
|
|
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 USE INDEX (ixEntityTagClientIdUserIdEntityTypeIsSecurityGroupTagId)
|
|
19
|
+
WHERE ut.clientId = usr.clientId
|
|
20
|
+
AND ut.userId = usr.userId
|
|
21
|
+
AND ut.entityType = 'User'
|
|
22
|
+
AND ut.isSecurityGroup = 1
|
|
23
|
+
)
|
|
24
|
+
)
|
|
25
|
+
UNION ALL
|
|
26
|
+
(
|
|
27
|
+
SELECT
|
|
28
|
+
d.clientId AS clientId,
|
|
29
|
+
d.imei AS imei,
|
|
30
|
+
usr.userId AS userId
|
|
31
|
+
FROM entityTag ut USE INDEX (ixEntityTagClientIdUserIdEntityTypeIsSecurityGroupTagId)
|
|
32
|
+
JOIN entityTag rt USE INDEX (ixEntityTagImeiIsSecurityGroupTagId)
|
|
33
|
+
ON rt.tagId = ut.tagId
|
|
34
|
+
AND rt.entityType = 'Device'
|
|
35
|
+
AND rt.isSecurityGroup = 1
|
|
36
|
+
AND rt.clientId = ut.clientId
|
|
37
|
+
JOIN userSecurityRole usr USE INDEX (ixUserSecurityRoleClientIdAccessUserId)
|
|
38
|
+
ON usr.clientId = rt.clientId
|
|
39
|
+
AND usr.userId = ut.userId
|
|
40
|
+
JOIN device d USE INDEX (ixDeviceClientIdImei)
|
|
41
|
+
ON d.clientId = rt.clientId
|
|
42
|
+
AND d.imei = rt.imei
|
|
43
|
+
WHERE ut.entityType = 'User'
|
|
44
|
+
AND ut.isSecurityGroup = 1
|
|
45
|
+
)
|
|
46
|
+
UNION ALL
|
|
47
|
+
(
|
|
48
|
+
SELECT
|
|
49
|
+
uad.clientId AS clientId,
|
|
50
|
+
uad.imei AS imei,
|
|
51
|
+
uad.userId AS userId
|
|
52
|
+
FROM userAuthorizedDevice uad
|
|
53
|
+
WHERE NOT EXISTS (
|
|
54
|
+
SELECT 1
|
|
55
|
+
FROM userSecurityRole usr USE INDEX (ixUserSecurityRoleClientIdAccessUserId)
|
|
56
|
+
WHERE usr.clientId = uad.clientId
|
|
57
|
+
AND usr.userId = uad.userId
|
|
58
|
+
AND usr.access = 'full'
|
|
59
|
+
)
|
|
60
|
+
AND NOT EXISTS (
|
|
61
|
+
SELECT 1
|
|
62
|
+
FROM entityTag ut USE INDEX (ixEntityTagClientIdUserIdEntityTypeIsSecurityGroupTagId)
|
|
63
|
+
WHERE ut.clientId = uad.clientId
|
|
64
|
+
AND ut.userId = uad.userId
|
|
65
|
+
AND ut.entityType = 'User'
|
|
66
|
+
AND ut.isSecurityGroup = 1
|
|
67
|
+
)
|
|
68
|
+
);
|
|
69
|
+
`);
|
|
70
|
+
await queryRunner.query(`
|
|
71
|
+
CREATE OR REPLACE VIEW \`user_authorized_boundary_security_view_v2\` AS
|
|
72
|
+
(
|
|
73
|
+
SELECT
|
|
74
|
+
b.clientId AS clientId,
|
|
75
|
+
usr.userId AS userId,
|
|
76
|
+
b.id AS boundaryId
|
|
77
|
+
FROM userSecurityRole usr USE INDEX (ixUserSecurityRoleClientIdAccessUserId)
|
|
78
|
+
JOIN boundary b
|
|
79
|
+
ON b.clientId = usr.clientId
|
|
80
|
+
WHERE usr.boundariesAccess = 'full'
|
|
81
|
+
AND NOT EXISTS (
|
|
82
|
+
SELECT 1
|
|
83
|
+
FROM entityTag ut USE INDEX (ixEntityTagClientIdUserIdEntityTypeIsSecurityGroupTagId)
|
|
84
|
+
WHERE ut.clientId = usr.clientId
|
|
85
|
+
AND ut.userId = usr.userId
|
|
86
|
+
AND ut.entityType = 'User'
|
|
87
|
+
AND ut.isSecurityGroup = 1
|
|
88
|
+
)
|
|
89
|
+
)
|
|
90
|
+
UNION ALL
|
|
91
|
+
(
|
|
92
|
+
SELECT
|
|
93
|
+
b.clientId AS clientId,
|
|
94
|
+
usr.userId AS userId,
|
|
95
|
+
b.id AS boundaryId
|
|
96
|
+
FROM entityTag ut USE INDEX (ixEntityTagClientIdUserIdEntityTypeIsSecurityGroupTagId)
|
|
97
|
+
JOIN entityTag rt
|
|
98
|
+
ON rt.tagId = ut.tagId
|
|
99
|
+
AND rt.entityType = 'Boundary'
|
|
100
|
+
AND rt.isSecurityGroup = 1
|
|
101
|
+
AND rt.clientId = ut.clientId
|
|
102
|
+
JOIN boundary b
|
|
103
|
+
ON b.clientId = rt.clientId
|
|
104
|
+
AND b.id = rt.entityId
|
|
105
|
+
JOIN userSecurityRole usr USE INDEX (ixUserSecurityRoleClientIdAccessUserId)
|
|
106
|
+
ON usr.clientId = rt.clientId
|
|
107
|
+
AND usr.userId = ut.userId
|
|
108
|
+
WHERE ut.entityType = 'User'
|
|
109
|
+
AND ut.isSecurityGroup = 1
|
|
110
|
+
)
|
|
111
|
+
UNION ALL
|
|
112
|
+
(
|
|
113
|
+
SELECT
|
|
114
|
+
uab.clientId AS clientId,
|
|
115
|
+
uab.userId AS userId,
|
|
116
|
+
uab.boundaryId AS boundaryId
|
|
117
|
+
FROM userAuthorizedBoundary uab
|
|
118
|
+
WHERE NOT EXISTS (
|
|
119
|
+
SELECT 1
|
|
120
|
+
FROM userSecurityRole usr USE INDEX (ixUserSecurityRoleClientIdAccessUserId)
|
|
121
|
+
WHERE usr.clientId = uab.clientId
|
|
122
|
+
AND usr.userId = uab.userId
|
|
123
|
+
AND usr.boundariesAccess = 'full'
|
|
124
|
+
)
|
|
125
|
+
AND NOT EXISTS (
|
|
126
|
+
SELECT 1
|
|
127
|
+
FROM entityTag ut USE INDEX (ixEntityTagClientIdUserIdEntityTypeIsSecurityGroupTagId)
|
|
128
|
+
WHERE ut.clientId = uab.clientId
|
|
129
|
+
AND ut.userId = uab.userId
|
|
130
|
+
AND ut.entityType = 'User'
|
|
131
|
+
AND ut.isSecurityGroup = 1
|
|
132
|
+
)
|
|
133
|
+
);
|
|
134
|
+
`);
|
|
135
|
+
}
|
|
136
|
+
async down(queryRunner) {
|
|
137
|
+
await queryRunner.query(`DROP VIEW IF EXISTS \`user_authorized_device_security_view_v2\`;`);
|
|
138
|
+
await queryRunner.query(`
|
|
139
|
+
DROP VIEW IF EXISTS \`user_authorized_boundary_security_view_v2\`;
|
|
140
|
+
`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
exports.updateSecurityUserViewsV21684483705002 = updateSecurityUserViewsV21684483705002;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _1684483704434AddLowerCaseIndex = require('../1684483704434-addLowerCaseIndex.js');
|
|
4
|
-
var
|
|
4
|
+
var _1684483705001UpdateSecurityUserViewsV1 = require('../1684483705001-updateSecurityUserViewsV1.js');
|
|
5
|
+
var _1684483705002UpdateSecurityUserViewsV2 = require('../1684483705002-updateSecurityUserViewsV2.js');
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
exports.addLowerCaseIndex1684483704434 = _1684483704434AddLowerCaseIndex.addLowerCaseIndex1684483704434;
|
|
9
|
-
exports.
|
|
10
|
+
exports.updateSecurityUserViewsV11684483705001 = _1684483705001UpdateSecurityUserViewsV1.updateSecurityUserViewsV11684483705001;
|
|
11
|
+
exports.updateSecurityUserViewsV21684483705002 = _1684483705002UpdateSecurityUserViewsV2.updateSecurityUserViewsV21684483705002;
|
package/dist/types/enums.d.ts
CHANGED
|
@@ -141,7 +141,8 @@ export declare enum StreamingStatus {
|
|
|
141
141
|
Requested = "requested",
|
|
142
142
|
Streaming = "streaming",
|
|
143
143
|
Closed = "closed",
|
|
144
|
-
Failed = "failed"
|
|
144
|
+
Failed = "failed",
|
|
145
|
+
Closing = "closing"
|
|
145
146
|
}
|
|
146
147
|
export declare enum DevicePlatform {
|
|
147
148
|
shopify = "shopify",
|