@nsshunt/stsdatamanagement 1.18.106 → 1.18.108
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/db-scripts/builddb.sql +35 -29
- package/package.json +16 -16
package/db-scripts/builddb.sql
CHANGED
|
@@ -112,7 +112,7 @@ DECLARE
|
|
|
112
112
|
BEGIN
|
|
113
113
|
begin
|
|
114
114
|
_resdesc_jsonb := _resdesc::jsonb;
|
|
115
|
-
_given := _resdesc_jsonb->'name'->0
|
|
115
|
+
_given := _resdesc_jsonb->'name'->0->'given'->>0;
|
|
116
116
|
_family := _resdesc_jsonb->'name'->0->>'family';
|
|
117
117
|
exception
|
|
118
118
|
when others then
|
|
@@ -196,7 +196,7 @@ declare
|
|
|
196
196
|
BEGIN
|
|
197
197
|
begin
|
|
198
198
|
_resdesc_jsonb := _resdesc::jsonb;
|
|
199
|
-
_given := _resdesc_jsonb->'name'->0
|
|
199
|
+
_given := _resdesc_jsonb->'name'->0->'given'->>0;
|
|
200
200
|
_family := _resdesc_jsonb->'name'->0->>'family';
|
|
201
201
|
exception
|
|
202
202
|
when others then
|
|
@@ -259,7 +259,7 @@ declare
|
|
|
259
259
|
BEGIN
|
|
260
260
|
begin
|
|
261
261
|
_resdesc_jsonb := _resdesc::jsonb;
|
|
262
|
-
_given := _resdesc_jsonb->'name'->0
|
|
262
|
+
_given := _resdesc_jsonb->'name'->0->'given'->>0;
|
|
263
263
|
_family := _resdesc_jsonb->'name'->0->>'family';
|
|
264
264
|
exception
|
|
265
265
|
when others then
|
|
@@ -339,7 +339,7 @@ BEGIN
|
|
|
339
339
|
update stsresource set validto = _now where oid = resoid;
|
|
340
340
|
|
|
341
341
|
insert into stsresource(resname, resdesc, resdesc_jsonb, given, family, vnum, dbaction, dbactionuser, validfrom)
|
|
342
|
-
select r.resname, r.resdesc, r.resdesc::jsonb, resdesc_jsonb->'name'->0
|
|
342
|
+
select r.resname, r.resdesc, r.resdesc::jsonb, resdesc_jsonb->'name'->0->'given'->>0, resdesc_jsonb->'name'->0->>'family', _resvnum+1, 3, _dbactionuser, _now
|
|
343
343
|
from stsresource r where r.oid = resoid
|
|
344
344
|
RETURNING oid INTO newresoid;
|
|
345
345
|
|
|
@@ -394,7 +394,7 @@ BEGIN
|
|
|
394
394
|
update stsresource set validto = _now where oid = resoid;
|
|
395
395
|
|
|
396
396
|
insert into stsresource(resname, resdesc, resdesc_jsonb, given, family, vnum, dbaction, dbactionuser, validfrom)
|
|
397
|
-
select r.resname, r.resdesc, r.resdesc::jsonb, resdesc_jsonb->'name'->0
|
|
397
|
+
select r.resname, r.resdesc, r.resdesc::jsonb, resdesc_jsonb->'name'->0->'given'->>0, resdesc_jsonb->'name'->0->>'family', _resvnum+1, 3, _dbactionuser, _now
|
|
398
398
|
from stsresource r where r.oid = resoid
|
|
399
399
|
RETURNING oid INTO newresoid;
|
|
400
400
|
|
|
@@ -871,7 +871,7 @@ CREATE INDEX idx_stsresource_id ON stsresource ((resdesc_jsonb->>'id'));
|
|
|
871
871
|
|
|
872
872
|
--DROP INDEX idx_stsresource_given;
|
|
873
873
|
CREATE INDEX idx_stsresource_given
|
|
874
|
-
ON stsresource ((resdesc_jsonb->'name'->0
|
|
874
|
+
ON stsresource ((resdesc_jsonb->'name'->0->'given'->>0))
|
|
875
875
|
WHERE resdesc_jsonb->>'_resourceType' = 'Person';
|
|
876
876
|
|
|
877
877
|
--drop index idx_stsresource_family;
|
|
@@ -911,7 +911,7 @@ BEGIN
|
|
|
911
911
|
return query
|
|
912
912
|
|
|
913
913
|
WITH temp_table_name AS (
|
|
914
|
-
SELECT r.resdesc_jsonb->'name'->0
|
|
914
|
+
SELECT r.resdesc_jsonb->'name'->0->'given'->>0 AS givenzz,
|
|
915
915
|
r.resdesc_jsonb->'name'->0->>'family' AS familyzz,
|
|
916
916
|
r.oid
|
|
917
917
|
FROM stsresource r
|
|
@@ -963,7 +963,7 @@ FROM (
|
|
|
963
963
|
WHERE
|
|
964
964
|
r.validto is null
|
|
965
965
|
AND r.given >= _given
|
|
966
|
-
AND r.given < _given || '
|
|
966
|
+
AND r.given < _given || 'zzzzzzzzzzz'
|
|
967
967
|
AND r.family >= _family
|
|
968
968
|
AND r.family < _family || 'zzzzzzzzzzzz'
|
|
969
969
|
) rt
|
|
@@ -1043,7 +1043,7 @@ BEGIN
|
|
|
1043
1043
|
-- Step 1: Create and populate the temporary table
|
|
1044
1044
|
CREATE TEMP TABLE temp_table_name AS
|
|
1045
1045
|
SELECT
|
|
1046
|
-
r.resdesc_jsonb->'name'->0
|
|
1046
|
+
r.resdesc_jsonb->'name'->0->'given'->>0 AS given,
|
|
1047
1047
|
r.resdesc_jsonb->'name'->0->>'family' AS family,
|
|
1048
1048
|
r.oid
|
|
1049
1049
|
FROM stsresource r
|
|
@@ -1096,7 +1096,7 @@ BEGIN
|
|
|
1096
1096
|
RETURN QUERY
|
|
1097
1097
|
SELECT subquery.given, subquery.family, subquery.oid
|
|
1098
1098
|
FROM (
|
|
1099
|
-
SELECT r.resdesc_jsonb->'name'->0
|
|
1099
|
+
SELECT r.resdesc_jsonb->'name'->0->'given'->>0 AS given,
|
|
1100
1100
|
r.resdesc_jsonb->'name'->0->>'family' AS family,
|
|
1101
1101
|
r.oid
|
|
1102
1102
|
FROM stsresource r
|
|
@@ -1148,7 +1148,7 @@ FROM (
|
|
|
1148
1148
|
innersq.family
|
|
1149
1149
|
FROM (
|
|
1150
1150
|
SELECT
|
|
1151
|
-
r.resdesc_jsonb->'name'->0
|
|
1151
|
+
r.resdesc_jsonb->'name'->0->'given'->>0 as given,
|
|
1152
1152
|
r.resdesc_jsonb->'name'->0->>'family' as family
|
|
1153
1153
|
FROM
|
|
1154
1154
|
stsresource r
|
|
@@ -1193,18 +1193,24 @@ DECLARE
|
|
|
1193
1193
|
BEGIN
|
|
1194
1194
|
|
|
1195
1195
|
RETURN QUERY
|
|
1196
|
-
SELECT DISTINCT
|
|
1196
|
+
SELECT DISTINCT
|
|
1197
|
+
sq.given, sq.family
|
|
1197
1198
|
FROM (
|
|
1198
|
-
SELECT
|
|
1199
|
-
|
|
1200
|
-
|
|
1199
|
+
SELECT
|
|
1200
|
+
resdesc_jsonb->'name'->0->'given'->>0 as given,
|
|
1201
|
+
resdesc_jsonb->'name'->0->>'family' as family
|
|
1202
|
+
FROM
|
|
1203
|
+
stsresource r
|
|
1204
|
+
WHERE
|
|
1205
|
+
r.resdesc_jsonb->>'_resourceType' = 'Person'
|
|
1201
1206
|
AND r.validto is null
|
|
1202
1207
|
AND r.resdesc_jsonb->'name'->0->>'family' >= _family
|
|
1203
1208
|
AND r.resdesc_jsonb->'name'->0->>'family' < _family || 'zzzzzzzzzzzz'
|
|
1204
|
-
AND r.resdesc_jsonb->'name'->0
|
|
1205
|
-
AND r.resdesc_jsonb->'name'->0
|
|
1209
|
+
AND r.resdesc_jsonb->'name'->0->'given'->>0 >= _given
|
|
1210
|
+
AND r.resdesc_jsonb->'name'->0->'given'->>0 < _given || 'zzzzzzzzzzzz'
|
|
1206
1211
|
) sq
|
|
1207
|
-
ORDER BY
|
|
1212
|
+
ORDER BY
|
|
1213
|
+
sq.given DESC
|
|
1208
1214
|
LIMIT _limit;
|
|
1209
1215
|
|
|
1210
1216
|
END;
|
|
@@ -1237,19 +1243,19 @@ BEGIN
|
|
|
1237
1243
|
|
|
1238
1244
|
RETURN QUERY
|
|
1239
1245
|
SELECT DISTINCT
|
|
1240
|
-
r.resdesc_jsonb->'name'->0
|
|
1246
|
+
r.resdesc_jsonb->'name'->0->'given'->>0 as given,
|
|
1241
1247
|
r.resdesc_jsonb->'name'->0->>'family' as family
|
|
1242
1248
|
FROM
|
|
1243
1249
|
stsresource r
|
|
1244
1250
|
WHERE
|
|
1245
1251
|
r.validto is null
|
|
1246
1252
|
AND r.resdesc_jsonb->>'_resourceType' = 'Person'
|
|
1247
|
-
AND r.resdesc_jsonb->'name'->0
|
|
1248
|
-
AND r.resdesc_jsonb->'name'->0
|
|
1253
|
+
AND r.resdesc_jsonb->'name'->0->'given'->>0 >= _given
|
|
1254
|
+
AND r.resdesc_jsonb->'name'->0->'given'->>0 < _given || 'zzzzzzzzzzz'
|
|
1249
1255
|
AND r.resdesc_jsonb->'name'->0->>'family' >= _family
|
|
1250
1256
|
AND r.resdesc_jsonb->'name'->0->>'family' < _family || 'zzzzzzzzzzz'
|
|
1251
1257
|
ORDER BY
|
|
1252
|
-
r.resdesc_jsonb->'name'->0
|
|
1258
|
+
r.resdesc_jsonb->'name'->0->'given'->>0 DESC,
|
|
1253
1259
|
r.resdesc_jsonb->'name'->0->>'family' DESC
|
|
1254
1260
|
LIMIT _limit;
|
|
1255
1261
|
|
|
@@ -1447,10 +1453,10 @@ FROM
|
|
|
1447
1453
|
WHERE
|
|
1448
1454
|
r.validto IS NULL
|
|
1449
1455
|
AND r.resdesc_jsonb->>'_resourceType' = 'Person'
|
|
1450
|
-
AND r.resdesc_jsonb->'name'->0
|
|
1451
|
-
AND r.resdesc_jsonb->'name'->0
|
|
1456
|
+
AND r.resdesc_jsonb->'name'->0->'given'->>0 >= _given
|
|
1457
|
+
AND r.resdesc_jsonb->'name'->0->'given'->>0 < _given || 'zzzzzzzzzzz'
|
|
1452
1458
|
ORDER BY
|
|
1453
|
-
r.resdesc_jsonb->'name'->0
|
|
1459
|
+
r.resdesc_jsonb->'name'->0->'given'->>0,
|
|
1454
1460
|
r.resdesc_jsonb->'name'->0->>'family',
|
|
1455
1461
|
r.resdesc_jsonb->'name'->0->>'id'
|
|
1456
1462
|
LIMIT _limit;
|
|
@@ -1489,7 +1495,7 @@ WHERE
|
|
|
1489
1495
|
AND r.resdesc_jsonb->'name'->0->>'family' < _family || 'zzzzzzzzzzzz'
|
|
1490
1496
|
ORDER BY
|
|
1491
1497
|
r.resdesc_jsonb->'name'->0->>'family',
|
|
1492
|
-
r.resdesc_jsonb->'name'->0
|
|
1498
|
+
r.resdesc_jsonb->'name'->0->'given'->>0,
|
|
1493
1499
|
r.resdesc_jsonb->'name'->0->>'id'
|
|
1494
1500
|
LIMIT _limit;
|
|
1495
1501
|
|
|
@@ -1524,12 +1530,12 @@ FROM
|
|
|
1524
1530
|
stsresource r
|
|
1525
1531
|
WHERE
|
|
1526
1532
|
r.validto IS NULL
|
|
1527
|
-
AND r.resdesc_jsonb->'name'->0
|
|
1528
|
-
AND r.resdesc_jsonb->'name'->0
|
|
1533
|
+
AND r.resdesc_jsonb->'name'->0->'given'->>0 >= quote_literal(_given)
|
|
1534
|
+
AND r.resdesc_jsonb->'name'->0->'given'->>0 < quote_literal(_given || 'zzzzzzzzzzz')
|
|
1529
1535
|
AND r.resdesc_jsonb->'name'->0->>'family' >= quote_literal(_family)
|
|
1530
1536
|
AND r.resdesc_jsonb->'name'->0->>'family' < quote_literal(_family || 'zzzzzzzzzzzz')
|
|
1531
1537
|
ORDER BY
|
|
1532
|
-
r.resdesc_jsonb->'name'->0
|
|
1538
|
+
r.resdesc_jsonb->'name'->0->'given'->>0,
|
|
1533
1539
|
r.resdesc_jsonb->'name'->0->>'family',
|
|
1534
1540
|
r.resdesc_jsonb->'name'->0->>'id'
|
|
1535
1541
|
LIMIT _limit;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nsshunt/stsdatamanagement",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.108",
|
|
4
4
|
"description": "STS Data Management Modules, Utilities and Services",
|
|
5
5
|
"main": "./dist/dbaccess.js",
|
|
6
6
|
"types": "./types/dbaccess.d.ts",
|
|
@@ -10,22 +10,22 @@
|
|
|
10
10
|
"db-scripts"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@aws-sdk/client-dynamodb": "^3.
|
|
14
|
-
"@aws-sdk/lib-dynamodb": "^3.
|
|
15
|
-
"@nsshunt/stsconfig": "^1.27.
|
|
16
|
-
"@nsshunt/stsutils": "^1.19.
|
|
13
|
+
"@aws-sdk/client-dynamodb": "^3.726.1",
|
|
14
|
+
"@aws-sdk/lib-dynamodb": "^3.726.1",
|
|
15
|
+
"@nsshunt/stsconfig": "^1.27.11",
|
|
16
|
+
"@nsshunt/stsutils": "^1.19.22",
|
|
17
17
|
"axios": "^1.7.9",
|
|
18
18
|
"chalk": "^4.1.2",
|
|
19
19
|
"cli-progress": "^3.12.0",
|
|
20
20
|
"http-status-codes": "^2.3.0",
|
|
21
|
-
"ioredis": "^5.4.
|
|
21
|
+
"ioredis": "^5.4.2",
|
|
22
22
|
"pg": "^8.13.1",
|
|
23
23
|
"pg-copy-streams": "^6.0.6",
|
|
24
24
|
"prompts": "^2.4.2",
|
|
25
25
|
"redis": "^4.7.0",
|
|
26
|
-
"systeminformation": "^5.
|
|
26
|
+
"systeminformation": "^5.25.11",
|
|
27
27
|
"tiny-emitter": "^2.1.0",
|
|
28
|
-
"uuid": "^11.0.
|
|
28
|
+
"uuid": "^11.0.5",
|
|
29
29
|
"winston": "^3.17.0"
|
|
30
30
|
},
|
|
31
31
|
"standard": {
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/cli-progress": "^3.11.6",
|
|
36
|
-
"@types/node": "^22.10.
|
|
36
|
+
"@types/node": "^22.10.6",
|
|
37
37
|
"@types/pg": "^8.11.10",
|
|
38
38
|
"@types/pg-copy-streams": "^1.2.5",
|
|
39
39
|
"@types/prompts": "^2.4.9",
|
|
40
40
|
"@types/uuid": "^10.0.0",
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
42
|
-
"@typescript-eslint/parser": "^8.
|
|
43
|
-
"eslint": "^9.
|
|
44
|
-
"globals": "^15.
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "^8.20.0",
|
|
42
|
+
"@typescript-eslint/parser": "^8.20.0",
|
|
43
|
+
"eslint": "^9.18.0",
|
|
44
|
+
"globals": "^15.14.0",
|
|
45
45
|
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
46
|
-
"rollup-plugin-visualizer": "^5.
|
|
46
|
+
"rollup-plugin-visualizer": "^5.14.0",
|
|
47
47
|
"testcontainers": "^10.16.0",
|
|
48
|
-
"typescript": "^5.7.
|
|
49
|
-
"vite": "^6.0.
|
|
48
|
+
"typescript": "^5.7.3",
|
|
49
|
+
"vite": "^6.0.7",
|
|
50
50
|
"vitest": "^2.1.8"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|