harperdb 4.4.17 → 4.5.0-alpha.1
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/README.md +1 -1
- package/bin/harperdb.js +79 -79
- package/bin/lite.js +79 -79
- package/config/yaml/defaultConfig.yaml +1 -0
- package/index.d.ts +2 -0
- package/json/systemSchema.json +3 -0
- package/launchServiceScripts/launchInstallNATSServer.js +3 -4
- package/launchServiceScripts/launchNatsIngestService.js +79 -79
- package/launchServiceScripts/launchNatsReplyService.js +79 -79
- package/launchServiceScripts/launchUpdateNodes4-0-0.js +79 -79
- package/npm-shrinkwrap.json +77 -44
- package/package.json +3 -2
- package/resources/RecordEncoder.d.ts +3 -1
- package/resources/analytics.d.ts +117 -3
- package/resources/auditStore.d.ts +3 -0
- package/resources/blob.d.ts +83 -0
- package/server/Server.d.ts +2 -0
- package/server/jobs/jobProcess.js +79 -79
- package/server/threads/threadServer.js +79 -79
- package/studio/build-local/asset-manifest.json +2 -2
- package/studio/build-local/index.html +1 -1
- package/studio/build-local/static/js/main.fc3cbc04.js +2 -0
- package/utility/install/README.md +2 -1
- package/utility/scripts/restartHdb.js +79 -79
- package/studio/build-local/static/js/main.510a0ad0.js +0 -2
- /package/studio/build-local/static/js/{main.510a0ad0.js.LICENSE.txt → main.fc3cbc04.js.LICENSE.txt} +0 -0
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "harperdb",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0-alpha.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "harperdb",
|
|
9
|
-
"version": "4.
|
|
9
|
+
"version": "4.5.0-alpha.1",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "SEE LICENSE IN LICENSE",
|
|
12
12
|
"dependencies": {
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@turf/helpers": "6.5.0",
|
|
28
28
|
"@turf/length": "6.5.0",
|
|
29
29
|
"alasql": "4.1.10",
|
|
30
|
+
"argon2": "0.41.1",
|
|
30
31
|
"cbor-x": "1.6.0",
|
|
31
32
|
"chalk": "4.1.2",
|
|
32
33
|
"cli-progress": "3.12.0",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"json2csv": "5.0.7",
|
|
46
47
|
"jsonata": "1.8.7",
|
|
47
48
|
"jsonwebtoken": "9.0.2",
|
|
48
|
-
"lmdb": "3.2.
|
|
49
|
+
"lmdb": "3.2.3",
|
|
49
50
|
"lodash": "4.17.21",
|
|
50
51
|
"mathjs": "11.12.0",
|
|
51
52
|
"minimist": "1.2.8",
|
|
@@ -1555,9 +1556,9 @@
|
|
|
1555
1556
|
}
|
|
1556
1557
|
},
|
|
1557
1558
|
"node_modules/@lmdb/lmdb-darwin-arm64": {
|
|
1558
|
-
"version": "3.2.
|
|
1559
|
-
"resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-arm64/-/lmdb-darwin-arm64-3.2.
|
|
1560
|
-
"integrity": "sha512-
|
|
1559
|
+
"version": "3.2.3",
|
|
1560
|
+
"resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-arm64/-/lmdb-darwin-arm64-3.2.3.tgz",
|
|
1561
|
+
"integrity": "sha512-SwC7ypweTtdyCv8zjuwLuTN7qLjin/zUihIENl1CyM25dLWYnsGOzvqoXzOgfE+PwQ9ZQP5q+Xz9kTXWQEjmXw==",
|
|
1561
1562
|
"cpu": [
|
|
1562
1563
|
"arm64"
|
|
1563
1564
|
],
|
|
@@ -1568,9 +1569,9 @@
|
|
|
1568
1569
|
]
|
|
1569
1570
|
},
|
|
1570
1571
|
"node_modules/@lmdb/lmdb-darwin-x64": {
|
|
1571
|
-
"version": "3.2.
|
|
1572
|
-
"resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-x64/-/lmdb-darwin-x64-3.2.
|
|
1573
|
-
"integrity": "sha512-
|
|
1572
|
+
"version": "3.2.3",
|
|
1573
|
+
"resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-x64/-/lmdb-darwin-x64-3.2.3.tgz",
|
|
1574
|
+
"integrity": "sha512-pQcqWu602nFkAXyNFodCY1OAi3he0JIMm1YSXu49+rVD29ybLjipyJqDcWMRFQWfb/RNquNmT77iqxXVIvvshQ==",
|
|
1574
1575
|
"cpu": [
|
|
1575
1576
|
"x64"
|
|
1576
1577
|
],
|
|
@@ -1581,9 +1582,9 @@
|
|
|
1581
1582
|
]
|
|
1582
1583
|
},
|
|
1583
1584
|
"node_modules/@lmdb/lmdb-linux-arm": {
|
|
1584
|
-
"version": "3.2.
|
|
1585
|
-
"resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm/-/lmdb-linux-arm-3.2.
|
|
1586
|
-
"integrity": "sha512-
|
|
1585
|
+
"version": "3.2.3",
|
|
1586
|
+
"resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm/-/lmdb-linux-arm-3.2.3.tgz",
|
|
1587
|
+
"integrity": "sha512-cdPrQ0lWNaauK4M4z61K6W7y04/5Vm3ATi9Xk+3FZeaIpnUE86BjtU9dD5MXYJpGcxY2qt1tcjDoaf28dShMOw==",
|
|
1587
1588
|
"cpu": [
|
|
1588
1589
|
"arm"
|
|
1589
1590
|
],
|
|
@@ -1594,9 +1595,9 @@
|
|
|
1594
1595
|
]
|
|
1595
1596
|
},
|
|
1596
1597
|
"node_modules/@lmdb/lmdb-linux-arm64": {
|
|
1597
|
-
"version": "3.2.
|
|
1598
|
-
"resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm64/-/lmdb-linux-arm64-3.2.
|
|
1599
|
-
"integrity": "sha512-
|
|
1598
|
+
"version": "3.2.3",
|
|
1599
|
+
"resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm64/-/lmdb-linux-arm64-3.2.3.tgz",
|
|
1600
|
+
"integrity": "sha512-RR4iwZpJGO5u+1p+bYAnb46X2DKMD5KMJlubO/q42zDvzUqnTHNeRfFy+1oqeCE3t1BBNy7+vssKRuGG4oUsIQ==",
|
|
1600
1601
|
"cpu": [
|
|
1601
1602
|
"arm64"
|
|
1602
1603
|
],
|
|
@@ -1607,9 +1608,9 @@
|
|
|
1607
1608
|
]
|
|
1608
1609
|
},
|
|
1609
1610
|
"node_modules/@lmdb/lmdb-linux-x64": {
|
|
1610
|
-
"version": "3.2.
|
|
1611
|
-
"resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-x64/-/lmdb-linux-x64-3.2.
|
|
1612
|
-
"integrity": "sha512-
|
|
1611
|
+
"version": "3.2.3",
|
|
1612
|
+
"resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-x64/-/lmdb-linux-x64-3.2.3.tgz",
|
|
1613
|
+
"integrity": "sha512-hty5uZqSa1+P6GyLdm+iWvJd4QkFez2+/AC0333+ql77eSOUeShU3a/9zFXDH8OTyTmrmsNuW7vuugu4D9uM1w==",
|
|
1613
1614
|
"cpu": [
|
|
1614
1615
|
"x64"
|
|
1615
1616
|
],
|
|
@@ -1620,9 +1621,9 @@
|
|
|
1620
1621
|
]
|
|
1621
1622
|
},
|
|
1622
1623
|
"node_modules/@lmdb/lmdb-win32-x64": {
|
|
1623
|
-
"version": "3.2.
|
|
1624
|
-
"resolved": "https://registry.npmjs.org/@lmdb/lmdb-win32-x64/-/lmdb-win32-x64-3.2.
|
|
1625
|
-
"integrity": "sha512-
|
|
1624
|
+
"version": "3.2.3",
|
|
1625
|
+
"resolved": "https://registry.npmjs.org/@lmdb/lmdb-win32-x64/-/lmdb-win32-x64-3.2.3.tgz",
|
|
1626
|
+
"integrity": "sha512-yO70BL6tfbS6k1Iwbu8EuCHv3Mg41k3QPk2AyufzAzmghjEyo5jk9UNOeUnL2Wiq1adtpdcI7tmjSlb3APczOA==",
|
|
1626
1627
|
"cpu": [
|
|
1627
1628
|
"x64"
|
|
1628
1629
|
],
|
|
@@ -1754,6 +1755,15 @@
|
|
|
1754
1755
|
"node": ">= 8"
|
|
1755
1756
|
}
|
|
1756
1757
|
},
|
|
1758
|
+
"node_modules/@phc/format": {
|
|
1759
|
+
"version": "1.0.0",
|
|
1760
|
+
"resolved": "https://registry.npmjs.org/@phc/format/-/format-1.0.0.tgz",
|
|
1761
|
+
"integrity": "sha512-m7X9U6BG2+J+R1lSOdCiITLLrxm+cWlNI3HUFA92oLO77ObGNzaKdh8pMLqdZcshtkKuV84olNNXDfMc4FezBQ==",
|
|
1762
|
+
"license": "MIT",
|
|
1763
|
+
"engines": {
|
|
1764
|
+
"node": ">=10"
|
|
1765
|
+
}
|
|
1766
|
+
},
|
|
1757
1767
|
"node_modules/@pkgjs/parseargs": {
|
|
1758
1768
|
"version": "0.11.0",
|
|
1759
1769
|
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
|
|
@@ -2975,9 +2985,9 @@
|
|
|
2975
2985
|
"license": "MIT"
|
|
2976
2986
|
},
|
|
2977
2987
|
"node_modules/@types/node": {
|
|
2978
|
-
"version": "22.
|
|
2979
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.
|
|
2980
|
-
"integrity": "sha512-
|
|
2988
|
+
"version": "22.13.1",
|
|
2989
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.1.tgz",
|
|
2990
|
+
"integrity": "sha512-jK8uzQlrvXqEU91UxiK5J7pKHyzgnI1Qnl0QDHIgVGuolJhRb9EEl28Cj9b3rGR8B2lhFCtvIm5os8lFnO/1Ew==",
|
|
2981
2991
|
"license": "MIT",
|
|
2982
2992
|
"dependencies": {
|
|
2983
2993
|
"undici-types": "~6.20.0"
|
|
@@ -3167,6 +3177,21 @@
|
|
|
3167
3177
|
"node": ">= 8"
|
|
3168
3178
|
}
|
|
3169
3179
|
},
|
|
3180
|
+
"node_modules/argon2": {
|
|
3181
|
+
"version": "0.41.1",
|
|
3182
|
+
"resolved": "https://registry.npmjs.org/argon2/-/argon2-0.41.1.tgz",
|
|
3183
|
+
"integrity": "sha512-dqCW8kJXke8Ik+McUcMDltrbuAWETPyU6iq+4AhxqKphWi7pChB/Zgd/Tp/o8xRLbg8ksMj46F/vph9wnxpTzQ==",
|
|
3184
|
+
"hasInstallScript": true,
|
|
3185
|
+
"license": "MIT",
|
|
3186
|
+
"dependencies": {
|
|
3187
|
+
"@phc/format": "^1.0.0",
|
|
3188
|
+
"node-addon-api": "^8.1.0",
|
|
3189
|
+
"node-gyp-build": "^4.8.1"
|
|
3190
|
+
},
|
|
3191
|
+
"engines": {
|
|
3192
|
+
"node": ">=16.17.0"
|
|
3193
|
+
}
|
|
3194
|
+
},
|
|
3170
3195
|
"node_modules/argparse": {
|
|
3171
3196
|
"version": "2.0.1",
|
|
3172
3197
|
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
|
@@ -3259,9 +3284,9 @@
|
|
|
3259
3284
|
}
|
|
3260
3285
|
},
|
|
3261
3286
|
"node_modules/bare-stream": {
|
|
3262
|
-
"version": "2.6.
|
|
3263
|
-
"resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.6.
|
|
3264
|
-
"integrity": "sha512-
|
|
3287
|
+
"version": "2.6.5",
|
|
3288
|
+
"resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.6.5.tgz",
|
|
3289
|
+
"integrity": "sha512-jSmxKJNJmHySi6hC42zlZnq00rga4jjxcgNZjY9N5WlOe/iOoGRtdwGsHzQv2RlH2KOYMwGUXhf2zXd32BA9RA==",
|
|
3265
3290
|
"license": "Apache-2.0",
|
|
3266
3291
|
"optional": true,
|
|
3267
3292
|
"dependencies": {
|
|
@@ -4506,9 +4531,9 @@
|
|
|
4506
4531
|
}
|
|
4507
4532
|
},
|
|
4508
4533
|
"node_modules/fastq": {
|
|
4509
|
-
"version": "1.
|
|
4510
|
-
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.
|
|
4511
|
-
"integrity": "sha512-
|
|
4534
|
+
"version": "1.19.0",
|
|
4535
|
+
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.0.tgz",
|
|
4536
|
+
"integrity": "sha512-7SFSRCNjBQIZH/xZR3iy5iQYR8aGBE0h3VG6/cwlbrpdciNYBMotQav8c1XI3HjHH+NikUpP53nPdlZSdWmFzA==",
|
|
4512
4537
|
"license": "ISC",
|
|
4513
4538
|
"dependencies": {
|
|
4514
4539
|
"reusify": "^1.0.4"
|
|
@@ -5524,9 +5549,9 @@
|
|
|
5524
5549
|
}
|
|
5525
5550
|
},
|
|
5526
5551
|
"node_modules/lmdb": {
|
|
5527
|
-
"version": "3.2.
|
|
5528
|
-
"resolved": "https://registry.npmjs.org/lmdb/-/lmdb-3.2.
|
|
5529
|
-
"integrity": "sha512-
|
|
5552
|
+
"version": "3.2.3",
|
|
5553
|
+
"resolved": "https://registry.npmjs.org/lmdb/-/lmdb-3.2.3.tgz",
|
|
5554
|
+
"integrity": "sha512-HPiEJ5mkhT19BFZjB82HWH4dgvy/IAvpwrZJ77EBsJ9YfZMwK8qWKZX6PutujR3vEgwUTYp9ayX6zuRHJNEDuw==",
|
|
5530
5555
|
"hasInstallScript": true,
|
|
5531
5556
|
"license": "MIT",
|
|
5532
5557
|
"dependencies": {
|
|
@@ -5540,14 +5565,20 @@
|
|
|
5540
5565
|
"download-lmdb-prebuilds": "bin/download-prebuilds.js"
|
|
5541
5566
|
},
|
|
5542
5567
|
"optionalDependencies": {
|
|
5543
|
-
"@lmdb/lmdb-darwin-arm64": "3.2.
|
|
5544
|
-
"@lmdb/lmdb-darwin-x64": "3.2.
|
|
5545
|
-
"@lmdb/lmdb-linux-arm": "3.2.
|
|
5546
|
-
"@lmdb/lmdb-linux-arm64": "3.2.
|
|
5547
|
-
"@lmdb/lmdb-linux-x64": "3.2.
|
|
5548
|
-
"@lmdb/lmdb-win32-x64": "3.2.
|
|
5568
|
+
"@lmdb/lmdb-darwin-arm64": "3.2.3",
|
|
5569
|
+
"@lmdb/lmdb-darwin-x64": "3.2.3",
|
|
5570
|
+
"@lmdb/lmdb-linux-arm": "3.2.3",
|
|
5571
|
+
"@lmdb/lmdb-linux-arm64": "3.2.3",
|
|
5572
|
+
"@lmdb/lmdb-linux-x64": "3.2.3",
|
|
5573
|
+
"@lmdb/lmdb-win32-x64": "3.2.3"
|
|
5549
5574
|
}
|
|
5550
5575
|
},
|
|
5576
|
+
"node_modules/lmdb/node_modules/node-addon-api": {
|
|
5577
|
+
"version": "6.1.0",
|
|
5578
|
+
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz",
|
|
5579
|
+
"integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==",
|
|
5580
|
+
"license": "MIT"
|
|
5581
|
+
},
|
|
5551
5582
|
"node_modules/lmdb/node_modules/node-gyp-build-optional-packages": {
|
|
5552
5583
|
"version": "5.2.2",
|
|
5553
5584
|
"resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.2.2.tgz",
|
|
@@ -5951,10 +5982,13 @@
|
|
|
5951
5982
|
}
|
|
5952
5983
|
},
|
|
5953
5984
|
"node_modules/node-addon-api": {
|
|
5954
|
-
"version": "
|
|
5955
|
-
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-
|
|
5956
|
-
"integrity": "sha512
|
|
5957
|
-
"license": "MIT"
|
|
5985
|
+
"version": "8.3.0",
|
|
5986
|
+
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.3.0.tgz",
|
|
5987
|
+
"integrity": "sha512-8VOpLHFrOQlAH+qA0ZzuGRlALRA6/LVh8QJldbrC4DY0hXoMP0l4Acq8TzFC018HztWiRqyCEj2aTWY2UvnJUg==",
|
|
5988
|
+
"license": "MIT",
|
|
5989
|
+
"engines": {
|
|
5990
|
+
"node": "^18 || ^20 || >= 21"
|
|
5991
|
+
}
|
|
5958
5992
|
},
|
|
5959
5993
|
"node_modules/node-fetch": {
|
|
5960
5994
|
"version": "2.7.0",
|
|
@@ -5990,7 +6024,6 @@
|
|
|
5990
6024
|
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz",
|
|
5991
6025
|
"integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==",
|
|
5992
6026
|
"license": "MIT",
|
|
5993
|
-
"optional": true,
|
|
5994
6027
|
"bin": {
|
|
5995
6028
|
"node-gyp-build": "bin.js",
|
|
5996
6029
|
"node-gyp-build-optional": "optional.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "harperdb",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0-alpha.1",
|
|
4
4
|
"description": "HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"database",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"@turf/helpers": "6.5.0",
|
|
61
61
|
"@turf/length": "6.5.0",
|
|
62
62
|
"alasql": "4.1.10",
|
|
63
|
+
"argon2": "0.41.1",
|
|
63
64
|
"cbor-x": "1.6.0",
|
|
64
65
|
"chalk": "4.1.2",
|
|
65
66
|
"cli-progress": "3.12.0",
|
|
@@ -78,7 +79,7 @@
|
|
|
78
79
|
"json2csv": "5.0.7",
|
|
79
80
|
"jsonata": "1.8.7",
|
|
80
81
|
"jsonwebtoken": "9.0.2",
|
|
81
|
-
"lmdb": "3.2.
|
|
82
|
+
"lmdb": "3.2.3",
|
|
82
83
|
"lodash": "4.17.21",
|
|
83
84
|
"mathjs": "11.12.0",
|
|
84
85
|
"minimist": "1.2.8",
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* patches the primary store to properly get the metadata and assign it to the entries.
|
|
6
6
|
*/
|
|
7
7
|
import { Encoder } from 'msgpackr';
|
|
8
|
+
import './blob';
|
|
8
9
|
export declare const TIMESTAMP_PLACEHOLDER: Uint8Array<ArrayBuffer>;
|
|
9
10
|
export declare const LAST_TIMESTAMP_PLACEHOLDER: Uint8Array<ArrayBuffer>;
|
|
10
11
|
export declare const PREVIOUS_TIMESTAMP_PLACEHOLDER: Uint8Array<ArrayBuffer>;
|
|
@@ -24,4 +25,5 @@ export declare class RecordEncoder extends Encoder {
|
|
|
24
25
|
decode(buffer: any, options: any): any;
|
|
25
26
|
}
|
|
26
27
|
export declare function handleLocalTimeForGets(store: any): any;
|
|
27
|
-
export declare function
|
|
28
|
+
export declare function recordUpdater(store: any, table_id: any, audit_store: any): (id: any, record: any, existing_entry: any, new_version: any, assign_metadata?: number, audit?: boolean, options?: any, type?: string, resolve_record?: boolean, audit_record?: any) => any;
|
|
29
|
+
export declare function removeEntry(store: any, entry: any, existing_version?: number): any;
|
package/resources/analytics.d.ts
CHANGED
|
@@ -1,9 +1,123 @@
|
|
|
1
|
-
|
|
1
|
+
type ActionCallback = (action: Action) => void;
|
|
2
|
+
export type Value = number | boolean | ActionCallback;
|
|
3
|
+
interface Action {
|
|
4
|
+
total?: number;
|
|
5
|
+
values?: Float32Array;
|
|
6
|
+
count?: number;
|
|
7
|
+
callback?: ActionCallback;
|
|
8
|
+
description?: {
|
|
9
|
+
metric: string;
|
|
10
|
+
path: string;
|
|
11
|
+
method: string;
|
|
12
|
+
type: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare function setAnalyticsEnabled(enabled: boolean): void;
|
|
2
16
|
/**
|
|
3
17
|
* Record an action for analytics (like an HTTP request, replication, MQTT message)
|
|
4
|
-
* @param path
|
|
5
18
|
* @param value
|
|
19
|
+
* @param metric
|
|
20
|
+
* @param path
|
|
21
|
+
* @param method
|
|
22
|
+
* @param type
|
|
6
23
|
*/
|
|
7
|
-
export declare function recordAction(value:
|
|
24
|
+
export declare function recordAction(value: Value, metric: string, path?: string, method?: string, type?: string): void;
|
|
8
25
|
export declare function recordActionBinary(value: any, metric: any, path?: any, method?: any, type?: any): void;
|
|
9
26
|
export declare function addAnalyticsListener(callback: any): void;
|
|
27
|
+
interface ResourceUsage extends Partial<NodeJS.ResourceUsage> {
|
|
28
|
+
time?: number;
|
|
29
|
+
period?: number;
|
|
30
|
+
cpuUtilization?: number;
|
|
31
|
+
}
|
|
32
|
+
/** calculateCPUUtilization takes a ResourceUsage with at least userCPUTime & systemCPUTime set
|
|
33
|
+
* with millisecond values (NB: Node's process.resourceUsage returns values in microseconds for
|
|
34
|
+
* these fields so divide them by 1000 to get milliseconds) and a time period in milliseconds
|
|
35
|
+
* and returns the percentage of that time the CPU was being utilized as a decimal value
|
|
36
|
+
* between 0 and 1. So for example, 50% utilization will be returned as 0.5.
|
|
37
|
+
*/
|
|
38
|
+
export declare function calculateCPUUtilization(resourceUsage: ResourceUsage, period: number): number;
|
|
39
|
+
/** diffResourceUsage takes a ResourceUsage representing the last time we stored them and a new
|
|
40
|
+
* process.resourceUsage() return value and normalizes and diffs the two values to return the
|
|
41
|
+
* new values for this time period.
|
|
42
|
+
*/
|
|
43
|
+
export declare function diffResourceUsage(lastResourceUsage: ResourceUsage, resourceUsage: NodeJS.ResourceUsage): ResourceUsage;
|
|
44
|
+
export {};
|
|
45
|
+
/**
|
|
46
|
+
* This section contains a possible/experimental approach to bucketing values as they come instead of pushing all into an array and sorting.
|
|
47
|
+
*
|
|
48
|
+
const BUCKET_COUNT = 100;
|
|
49
|
+
function addToBucket(action, value) {
|
|
50
|
+
if (!action.buckets) {
|
|
51
|
+
action.buckets = newBuckets();
|
|
52
|
+
}
|
|
53
|
+
const { counts, values, totalCount } = action.buckets;
|
|
54
|
+
let jump = BUCKET_COUNT >> 1; // amount to jump with each iteration
|
|
55
|
+
let position = jump; // start at halfway point
|
|
56
|
+
while ((jump = jump >> 1) > 0) {
|
|
57
|
+
const bucket_value = values[position];
|
|
58
|
+
if (bucket_value === 0) {
|
|
59
|
+
// unused slot, immediately put our value in
|
|
60
|
+
counts[position] = 1;
|
|
61
|
+
values[position] = value;
|
|
62
|
+
}
|
|
63
|
+
if (value > bucket_value) {
|
|
64
|
+
position += jump;
|
|
65
|
+
} else {
|
|
66
|
+
position -= jump;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const count = counts[position] + 1;
|
|
70
|
+
if (position === BUCKET_COUNT) {
|
|
71
|
+
// if we go beyond the last item, increase the bucket (max) value
|
|
72
|
+
position--;
|
|
73
|
+
values[position] = value;
|
|
74
|
+
}
|
|
75
|
+
if (count > threshold) {
|
|
76
|
+
rebalance(action.buckets, false);
|
|
77
|
+
} else {
|
|
78
|
+
counts[position] = count;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function newBuckets() {
|
|
83
|
+
const ab = new ArrayBuffer(8 * BUCKET_COUNT);
|
|
84
|
+
return {
|
|
85
|
+
values: new Float32Array(ab, 0, BUCKET_COUNT),
|
|
86
|
+
counts: new Uint32Array(ab, BUCKET_COUNT * 4, BUCKET_COUNT),
|
|
87
|
+
totalCount: 0,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
let balancing_buckets;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Rebalance the buckets, we can reset the counts at the same time, if this occurred after a delivery
|
|
95
|
+
* @param param
|
|
96
|
+
* @param reset_counts
|
|
97
|
+
*
|
|
98
|
+
function rebalance({ counts, values, totalCount }, reset_counts: boolean) {
|
|
99
|
+
const count_per_bucket = totalCount / BUCKET_COUNT;
|
|
100
|
+
let target_position = 0;
|
|
101
|
+
let target_count = 0;
|
|
102
|
+
let last_target_value = 0;
|
|
103
|
+
const { values: target_values, counts: target_counts } = balancing_buckets || (balancing_buckets = newBuckets());
|
|
104
|
+
for (let i = 0; i < BUCKET_COUNT; i++) {
|
|
105
|
+
// iterate through the existing buckets, filling up the target buckets in a balanced way
|
|
106
|
+
let count = counts[i];
|
|
107
|
+
while ((count_per_bucket - target_count) < count) {
|
|
108
|
+
const value = values[i];
|
|
109
|
+
last_target_value = ((count_per_bucket - target_count) / count) * (value - last_target_value) + last_target_value;
|
|
110
|
+
target_values[target_position] = last_target_value;
|
|
111
|
+
target_counts[target_position] = count_per_bucket;
|
|
112
|
+
count -= count_per_bucket;
|
|
113
|
+
target_position++;
|
|
114
|
+
target_count = 0;
|
|
115
|
+
}
|
|
116
|
+
target_count += count;
|
|
117
|
+
}
|
|
118
|
+
// now copy the balanced buckets back into the original buckets
|
|
119
|
+
values.set(target_values);
|
|
120
|
+
if (reset_counts) counts.fill(0);
|
|
121
|
+
else counts.set(target_counts);
|
|
122
|
+
}
|
|
123
|
+
*/
|
|
@@ -13,12 +13,15 @@ export declare function openAuditStore(root_store: any): any;
|
|
|
13
13
|
export declare function removeAuditEntry(audit_store: any, key: number, value: any): Promise<void>;
|
|
14
14
|
export declare function getLastRemoved(audit_store: any): number;
|
|
15
15
|
export declare function setAuditRetention(retention_time: any, default_delay?: number): void;
|
|
16
|
+
export declare const ACTION_32_BIT = 14;
|
|
17
|
+
export declare const ACTION_64_BIT = 15;
|
|
16
18
|
/** Used to indicate we have received a remote local time update */
|
|
17
19
|
export declare const REMOTE_SEQUENCE_UPDATE = 11;
|
|
18
20
|
export declare const HAS_CURRENT_RESIDENCY_ID = 512;
|
|
19
21
|
export declare const HAS_PREVIOUS_RESIDENCY_ID = 1024;
|
|
20
22
|
export declare const HAS_ORIGINATING_OPERATION = 2048;
|
|
21
23
|
export declare const HAS_EXPIRATION_EXTENDED_TYPE = 4096;
|
|
24
|
+
export declare const HAS_BLOBS = 8192;
|
|
22
25
|
/**
|
|
23
26
|
* Creates a binary audit entry
|
|
24
27
|
* @param txn_time
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module provides a Blob class that can be used to store binary data in the database, and can be used to store large binary data in a file
|
|
3
|
+
* on the server. The Blob class is a subclass of the global Blob class, and can be used in the same way.
|
|
4
|
+
* The Blob-backed files begin with an 8-byte header:
|
|
5
|
+
* - The first 2 bytes indicate the type of storage:
|
|
6
|
+
* - 0: Uncompressed
|
|
7
|
+
* - 1: Compressed with deflate
|
|
8
|
+
* - The next 6 bytes are the size of the content
|
|
9
|
+
* - While the file is being written, 0xffffffffffff is used as a placeholder to indicate that the file is not finished being written (this nicely matches the logic that if the written content size is less than the indicated content size, it is not finished)
|
|
10
|
+
* - Note that for compressed data, the size is the uncompressed size, and the compressed size in the file
|
|
11
|
+
*/
|
|
12
|
+
export declare const Blob: {
|
|
13
|
+
new (blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
|
|
14
|
+
prototype: Blob;
|
|
15
|
+
} | {
|
|
16
|
+
new (contents: Buffer[]): {
|
|
17
|
+
content: Buffer;
|
|
18
|
+
stream(): ReadableStream<any>;
|
|
19
|
+
text(): Promise<string>;
|
|
20
|
+
arrayBuffer(): Promise<ArrayBufferLike>;
|
|
21
|
+
readonly size: number;
|
|
22
|
+
slice(): void;
|
|
23
|
+
bytes(): Promise<Buffer>;
|
|
24
|
+
readonly type: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare let blobsWereEncoded: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* A blob that is backed by a file, and can be saved to the database as a reference
|
|
30
|
+
*/
|
|
31
|
+
declare class FileBackedBlob extends Blob {
|
|
32
|
+
finished: Promise<void>;
|
|
33
|
+
onError: ((error: Error) => void)[];
|
|
34
|
+
constructor(options?: FilePropertyBag);
|
|
35
|
+
on(type: string, callback: (error: Error) => void): void;
|
|
36
|
+
toJSON(): {
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
text(): Promise<string>;
|
|
40
|
+
bytes(): Promise<Buffer>;
|
|
41
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
42
|
+
stream(): ReadableStream;
|
|
43
|
+
get size(): number;
|
|
44
|
+
slice(): void;
|
|
45
|
+
get type(): string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Delete the file for the blob
|
|
49
|
+
* @param blob
|
|
50
|
+
*/
|
|
51
|
+
export declare function deleteBlob(blob: Blob): Promise<void>;
|
|
52
|
+
export declare function setDeletionDelay(delay: number): void;
|
|
53
|
+
export type BlobCreationOptions = {
|
|
54
|
+
compress?: boolean;
|
|
55
|
+
flush?: boolean;
|
|
56
|
+
size?: number;
|
|
57
|
+
forBlob: (blob: Blob) => any;
|
|
58
|
+
};
|
|
59
|
+
export declare function getFileId(blob: Blob): string;
|
|
60
|
+
export declare function getFilePathForBlob(blob: FileBackedBlob): string;
|
|
61
|
+
/**
|
|
62
|
+
* Encode blobs with file paths, so that they can be saved to the database
|
|
63
|
+
* @param callback
|
|
64
|
+
* @param encodingId
|
|
65
|
+
* @param objectToClear
|
|
66
|
+
*/
|
|
67
|
+
export declare function encodeBlobsWithFilePath<T>(callback: () => T, encodingId: number): T;
|
|
68
|
+
/**
|
|
69
|
+
* Decode blobs, creating local storage to hold the blogs and returning a promise that resolves when all the blobs are written to disk
|
|
70
|
+
* @param callback
|
|
71
|
+
*/
|
|
72
|
+
export declare function decodeBlobsWithWrites(callback: () => void, blobCallback?: (blob: Blob) => void): void | Promise<void> | Promise<void[]>;
|
|
73
|
+
/**
|
|
74
|
+
* Decode with a callback for when blobs are encountered, allowing for detecting of blobs
|
|
75
|
+
* @param callback
|
|
76
|
+
*/
|
|
77
|
+
export declare function decodeWithBlobCallback(callback: () => void, blobCallback: (blob: Blob) => void): void;
|
|
78
|
+
/**
|
|
79
|
+
* Delete blobs in an object, recursively searching for blobs
|
|
80
|
+
* @param object
|
|
81
|
+
*/
|
|
82
|
+
export declare function deleteBlobsInObject(object: any): void;
|
|
83
|
+
export {};
|
package/server/Server.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Socket } from 'net';
|
|
2
|
+
import type { Value } from '../resources/analytics';
|
|
2
3
|
/**
|
|
3
4
|
* This is the central interface by which we define entry points for different server protocol plugins to listen for
|
|
4
5
|
* incoming connections and requests.
|
|
@@ -11,6 +12,7 @@ interface Server {
|
|
|
11
12
|
contentTypes: Map<string, ContentTypeHandler>;
|
|
12
13
|
getUser(username: string, password: string | null, request: Request): any;
|
|
13
14
|
operation(operation: any, context: any, authorize?: boolean): Promise<any>;
|
|
15
|
+
recordAnalytics(value: Value, metric: string, path?: string, method?: string, type?: string): void;
|
|
14
16
|
}
|
|
15
17
|
interface ServerOptions {
|
|
16
18
|
port?: number;
|