querysub 0.437.0 → 0.438.0
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/.eslintrc.js +50 -50
- package/bin/deploy.js +0 -0
- package/bin/function.js +0 -0
- package/bin/server.js +0 -0
- package/costsBenefits.txt +115 -115
- package/deploy.ts +2 -2
- package/package.json +1 -1
- package/spec.txt +1192 -1192
- package/src/-a-archives/archives.ts +202 -202
- package/src/-a-archives/archivesDisk.ts +454 -454
- package/src/-a-auth/certs.ts +540 -540
- package/src/-a-auth/node-forge-ed25519.d.ts +16 -16
- package/src/-b-authorities/dnsAuthority.ts +138 -138
- package/src/-c-identity/IdentityController.ts +258 -258
- package/src/-d-trust/NetworkTrust2.ts +180 -180
- package/src/-e-certs/EdgeCertController.ts +252 -252
- package/src/-e-certs/certAuthority.ts +201 -201
- package/src/-f-node-discovery/NodeDiscovery.ts +640 -640
- package/src/-g-core-values/NodeCapabilities.ts +200 -200
- package/src/-h-path-value-serialize/stringSerializer.ts +175 -175
- package/src/0-path-value-core/PathValueCommitter.ts +468 -468
- package/src/0-path-value-core/PathValueController.ts +0 -2
- package/src/2-proxy/PathValueProxyWatcher.ts +2542 -2542
- package/src/2-proxy/TransactionDelayer.ts +94 -94
- package/src/2-proxy/pathDatabaseProxyBase.ts +36 -36
- package/src/2-proxy/pathValueProxy.ts +159 -159
- package/src/3-path-functions/PathFunctionRunnerMain.ts +87 -87
- package/src/3-path-functions/pathFunctionLoader.ts +516 -516
- package/src/3-path-functions/tests/rejectTest.ts +76 -76
- package/src/4-deploy/deployCheck.ts +6 -6
- package/src/4-dom/css.tsx +29 -29
- package/src/4-dom/cssTypes.d.ts +211 -211
- package/src/4-dom/qreact.tsx +2799 -2799
- package/src/4-dom/qreactTest.tsx +410 -410
- package/src/4-querysub/permissions.ts +335 -335
- package/src/4-querysub/querysubPrediction.ts +483 -483
- package/src/5-diagnostics/qreactDebug.tsx +377 -346
- package/src/TestController.ts +34 -34
- package/src/bits.ts +104 -104
- package/src/buffers.ts +69 -69
- package/src/diagnostics/ActionsHistory.ts +57 -57
- package/src/diagnostics/listenOnDebugger.ts +71 -71
- package/src/diagnostics/periodic.ts +111 -111
- package/src/diagnostics/trackResources.ts +91 -91
- package/src/diagnostics/watchdog.ts +120 -120
- package/src/errors.ts +133 -133
- package/src/forceProduction.ts +2 -2
- package/src/fs.ts +80 -80
- package/src/functional/diff.ts +857 -857
- package/src/functional/promiseCache.ts +78 -78
- package/src/functional/random.ts +8 -8
- package/src/functional/stats.ts +60 -60
- package/src/heapDumps.ts +665 -665
- package/src/https.ts +1 -1
- package/src/library-components/AspectSizedComponent.tsx +87 -87
- package/src/library-components/ButtonSelector.tsx +64 -64
- package/src/library-components/DropdownCustom.tsx +150 -150
- package/src/library-components/DropdownSelector.tsx +31 -31
- package/src/library-components/InlinePopup.tsx +66 -66
- package/src/misc/color.ts +29 -29
- package/src/misc/hash.ts +83 -83
- package/src/misc/ipPong.js +13 -13
- package/src/misc/networking.ts +1 -1
- package/src/misc/random.ts +44 -44
- package/src/misc.ts +196 -196
- package/src/path.ts +255 -255
- package/src/persistentLocalStore.ts +41 -41
- package/src/promise.ts +14 -14
- package/src/storage/fileSystemPointer.ts +71 -71
- package/src/test/heapProcess.ts +35 -35
- package/src/zip.ts +15 -15
- package/tsconfig.json +26 -26
- package/yarnSpec.txt +56 -56
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { proxyWatcher } from "../2-proxy/PathValueProxyWatcher";
|
|
2
|
-
import { cacheLimited } from "socket-function/src/caching";
|
|
3
|
-
|
|
4
|
-
// IMPORTANT! See getSyncedController if you just want to run controller functions
|
|
5
|
-
|
|
6
|
-
export function cacheAsyncLimited<Arg, Return>(limit: number, fnc: (arg: Arg) => Promise<Return>) {
|
|
7
|
-
let results = new Map<Arg, { type: "result"; value: Return } | { type: "error"; error: Error; }>();
|
|
8
|
-
let promiseValues = cacheLimited(limit, fnc);
|
|
9
|
-
return function get(arg: Arg) {
|
|
10
|
-
let result = results.get(arg);
|
|
11
|
-
if (result) {
|
|
12
|
-
if (result.type === "result") {
|
|
13
|
-
return result.value;
|
|
14
|
-
} else {
|
|
15
|
-
throw result.error;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
let promise = promiseValues(arg);
|
|
19
|
-
promise.then(
|
|
20
|
-
value => {
|
|
21
|
-
if (results.size >= limit) results.clear();
|
|
22
|
-
results.set(arg, { type: "result", value });
|
|
23
|
-
},
|
|
24
|
-
error => {
|
|
25
|
-
if (results.size >= limit) results.clear();
|
|
26
|
-
results.set(arg, { type: "error", error });
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
proxyWatcher.triggerOnPromiseFinish(promise, { waitReason: fnc.toString() });
|
|
30
|
-
return undefined;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const cacheAsyncSynced = cacheAsyncLimitedJSON;
|
|
35
|
-
export function cacheAsyncLimitedJSON<Arg, Return>(
|
|
36
|
-
limit: number,
|
|
37
|
-
fnc: (arg: Arg) => Promise<Return>,
|
|
38
|
-
config?: {
|
|
39
|
-
notReadyValue?: Return;
|
|
40
|
-
}
|
|
41
|
-
): ((arg: Arg) => Return | undefined) & {
|
|
42
|
-
clear(): void;
|
|
43
|
-
promise: (arg: Arg) => Promise<Return>;
|
|
44
|
-
} {
|
|
45
|
-
let results = new Map<string, { type: "result"; value: Return } | { type: "error"; error: Error; }>();
|
|
46
|
-
let promiseValues = cacheLimited(limit, (json: string) => fnc(JSON.parse(json)));
|
|
47
|
-
get["clear"] = () => {
|
|
48
|
-
results.clear();
|
|
49
|
-
promiseValues.clear();
|
|
50
|
-
};
|
|
51
|
-
get.promise = (arg: Arg) => {
|
|
52
|
-
return promiseValues(JSON.stringify(arg));
|
|
53
|
-
};
|
|
54
|
-
return get;
|
|
55
|
-
function get(arg: Arg) {
|
|
56
|
-
let json = JSON.stringify(arg);
|
|
57
|
-
let result = results.get(json);
|
|
58
|
-
if (result) {
|
|
59
|
-
if (result.type === "result") {
|
|
60
|
-
return result.value;
|
|
61
|
-
} else {
|
|
62
|
-
throw result.error;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
let promise = promiseValues(json);
|
|
66
|
-
promise.then(
|
|
67
|
-
value => {
|
|
68
|
-
if (results.size >= limit) results.clear();
|
|
69
|
-
results.set(json, { type: "result", value });
|
|
70
|
-
},
|
|
71
|
-
error => {
|
|
72
|
-
if (results.size >= limit) results.clear();
|
|
73
|
-
results.set(json, { type: "error", error });
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
proxyWatcher.triggerOnPromiseFinish(promise, { waitReason: fnc.toString() });
|
|
77
|
-
return config?.notReadyValue;
|
|
78
|
-
};
|
|
1
|
+
import { proxyWatcher } from "../2-proxy/PathValueProxyWatcher";
|
|
2
|
+
import { cacheLimited } from "socket-function/src/caching";
|
|
3
|
+
|
|
4
|
+
// IMPORTANT! See getSyncedController if you just want to run controller functions
|
|
5
|
+
|
|
6
|
+
export function cacheAsyncLimited<Arg, Return>(limit: number, fnc: (arg: Arg) => Promise<Return>) {
|
|
7
|
+
let results = new Map<Arg, { type: "result"; value: Return } | { type: "error"; error: Error; }>();
|
|
8
|
+
let promiseValues = cacheLimited(limit, fnc);
|
|
9
|
+
return function get(arg: Arg) {
|
|
10
|
+
let result = results.get(arg);
|
|
11
|
+
if (result) {
|
|
12
|
+
if (result.type === "result") {
|
|
13
|
+
return result.value;
|
|
14
|
+
} else {
|
|
15
|
+
throw result.error;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
let promise = promiseValues(arg);
|
|
19
|
+
promise.then(
|
|
20
|
+
value => {
|
|
21
|
+
if (results.size >= limit) results.clear();
|
|
22
|
+
results.set(arg, { type: "result", value });
|
|
23
|
+
},
|
|
24
|
+
error => {
|
|
25
|
+
if (results.size >= limit) results.clear();
|
|
26
|
+
results.set(arg, { type: "error", error });
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
proxyWatcher.triggerOnPromiseFinish(promise, { waitReason: fnc.toString() });
|
|
30
|
+
return undefined;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const cacheAsyncSynced = cacheAsyncLimitedJSON;
|
|
35
|
+
export function cacheAsyncLimitedJSON<Arg, Return>(
|
|
36
|
+
limit: number,
|
|
37
|
+
fnc: (arg: Arg) => Promise<Return>,
|
|
38
|
+
config?: {
|
|
39
|
+
notReadyValue?: Return;
|
|
40
|
+
}
|
|
41
|
+
): ((arg: Arg) => Return | undefined) & {
|
|
42
|
+
clear(): void;
|
|
43
|
+
promise: (arg: Arg) => Promise<Return>;
|
|
44
|
+
} {
|
|
45
|
+
let results = new Map<string, { type: "result"; value: Return } | { type: "error"; error: Error; }>();
|
|
46
|
+
let promiseValues = cacheLimited(limit, (json: string) => fnc(JSON.parse(json)));
|
|
47
|
+
get["clear"] = () => {
|
|
48
|
+
results.clear();
|
|
49
|
+
promiseValues.clear();
|
|
50
|
+
};
|
|
51
|
+
get.promise = (arg: Arg) => {
|
|
52
|
+
return promiseValues(JSON.stringify(arg));
|
|
53
|
+
};
|
|
54
|
+
return get;
|
|
55
|
+
function get(arg: Arg) {
|
|
56
|
+
let json = JSON.stringify(arg);
|
|
57
|
+
let result = results.get(json);
|
|
58
|
+
if (result) {
|
|
59
|
+
if (result.type === "result") {
|
|
60
|
+
return result.value;
|
|
61
|
+
} else {
|
|
62
|
+
throw result.error;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
let promise = promiseValues(json);
|
|
66
|
+
promise.then(
|
|
67
|
+
value => {
|
|
68
|
+
if (results.size >= limit) results.clear();
|
|
69
|
+
results.set(json, { type: "result", value });
|
|
70
|
+
},
|
|
71
|
+
error => {
|
|
72
|
+
if (results.size >= limit) results.clear();
|
|
73
|
+
results.set(json, { type: "error", error });
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
proxyWatcher.triggerOnPromiseFinish(promise, { waitReason: fnc.toString() });
|
|
77
|
+
return config?.notReadyValue;
|
|
78
|
+
};
|
|
79
79
|
}
|
package/src/functional/random.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { critz } from "./stats";
|
|
2
|
-
import { getSeededRandom, shuffle } from "../misc/random";
|
|
3
|
-
|
|
4
|
-
export function getSeededRandomNormal(seed: number, mean: number, stdDev: number) {
|
|
5
|
-
let rand = getSeededRandom(seed);
|
|
6
|
-
return () => {
|
|
7
|
-
return critz(rand()) * stdDev + mean;
|
|
8
|
-
};
|
|
1
|
+
import { critz } from "./stats";
|
|
2
|
+
import { getSeededRandom, shuffle } from "../misc/random";
|
|
3
|
+
|
|
4
|
+
export function getSeededRandomNormal(seed: number, mean: number, stdDev: number) {
|
|
5
|
+
let rand = getSeededRandom(seed);
|
|
6
|
+
return () => {
|
|
7
|
+
return critz(rand()) * stdDev + mean;
|
|
8
|
+
};
|
|
9
9
|
}
|
package/src/functional/stats.ts
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
// https://stackoverflow.com/questions/36575743/how-do-i-convert-probability-into-z-score
|
|
2
|
-
|
|
3
|
-
var Z_MAX = 6;
|
|
4
|
-
export function poz(z: number) {
|
|
5
|
-
|
|
6
|
-
var y, x, w;
|
|
7
|
-
|
|
8
|
-
if (z === 0.0) {
|
|
9
|
-
x = 0.0;
|
|
10
|
-
} else {
|
|
11
|
-
y = 0.5 * Math.abs(z);
|
|
12
|
-
if (y > (Z_MAX * 0.5)) {
|
|
13
|
-
x = 1.0;
|
|
14
|
-
} else if (y < 1.0) {
|
|
15
|
-
w = y * y;
|
|
16
|
-
x = ((((((((0.000124818987 * w
|
|
17
|
-
- 0.001075204047) * w + 0.005198775019) * w
|
|
18
|
-
- 0.019198292004) * w + 0.059054035642) * w
|
|
19
|
-
- 0.151968751364) * w + 0.319152932694) * w
|
|
20
|
-
- 0.531923007300) * w + 0.797884560593) * y * 2.0;
|
|
21
|
-
} else {
|
|
22
|
-
y -= 2.0;
|
|
23
|
-
x = (((((((((((((-0.000045255659 * y
|
|
24
|
-
+ 0.000152529290) * y - 0.000019538132) * y
|
|
25
|
-
- 0.000676904986) * y + 0.001390604284) * y
|
|
26
|
-
- 0.000794620820) * y - 0.002034254874) * y
|
|
27
|
-
+ 0.006549791214) * y - 0.010557625006) * y
|
|
28
|
-
+ 0.011630447319) * y - 0.009279453341) * y
|
|
29
|
-
+ 0.005353579108) * y - 0.002141268741) * y
|
|
30
|
-
+ 0.000535310849) * y + 0.999936657524;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return z > 0.0 ? ((x + 1.0) * 0.5) : ((1.0 - x) * 0.5);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/* CRITZ -- Compute critical normal z value to
|
|
38
|
-
produce given p. We just do a bisection
|
|
39
|
-
search for a value within CHI_EPSILON,
|
|
40
|
-
relying on the monotonicity of pochisq(). */
|
|
41
|
-
|
|
42
|
-
export function critz(p: number) {
|
|
43
|
-
var Z_EPSILON = 0.000001; /* Accuracy of z approximation */
|
|
44
|
-
var minz = -Z_MAX;
|
|
45
|
-
var maxz = Z_MAX;
|
|
46
|
-
var zval = 0.0;
|
|
47
|
-
var pval;
|
|
48
|
-
if (p < 0.0) p = 0.0;
|
|
49
|
-
if (p > 1.0) p = 1.0;
|
|
50
|
-
|
|
51
|
-
while ((maxz - minz) > Z_EPSILON) {
|
|
52
|
-
pval = poz(zval);
|
|
53
|
-
if (pval > p) {
|
|
54
|
-
maxz = zval;
|
|
55
|
-
} else {
|
|
56
|
-
minz = zval;
|
|
57
|
-
}
|
|
58
|
-
zval = (maxz + minz) * 0.5;
|
|
59
|
-
}
|
|
60
|
-
return (zval);
|
|
1
|
+
// https://stackoverflow.com/questions/36575743/how-do-i-convert-probability-into-z-score
|
|
2
|
+
|
|
3
|
+
var Z_MAX = 6;
|
|
4
|
+
export function poz(z: number) {
|
|
5
|
+
|
|
6
|
+
var y, x, w;
|
|
7
|
+
|
|
8
|
+
if (z === 0.0) {
|
|
9
|
+
x = 0.0;
|
|
10
|
+
} else {
|
|
11
|
+
y = 0.5 * Math.abs(z);
|
|
12
|
+
if (y > (Z_MAX * 0.5)) {
|
|
13
|
+
x = 1.0;
|
|
14
|
+
} else if (y < 1.0) {
|
|
15
|
+
w = y * y;
|
|
16
|
+
x = ((((((((0.000124818987 * w
|
|
17
|
+
- 0.001075204047) * w + 0.005198775019) * w
|
|
18
|
+
- 0.019198292004) * w + 0.059054035642) * w
|
|
19
|
+
- 0.151968751364) * w + 0.319152932694) * w
|
|
20
|
+
- 0.531923007300) * w + 0.797884560593) * y * 2.0;
|
|
21
|
+
} else {
|
|
22
|
+
y -= 2.0;
|
|
23
|
+
x = (((((((((((((-0.000045255659 * y
|
|
24
|
+
+ 0.000152529290) * y - 0.000019538132) * y
|
|
25
|
+
- 0.000676904986) * y + 0.001390604284) * y
|
|
26
|
+
- 0.000794620820) * y - 0.002034254874) * y
|
|
27
|
+
+ 0.006549791214) * y - 0.010557625006) * y
|
|
28
|
+
+ 0.011630447319) * y - 0.009279453341) * y
|
|
29
|
+
+ 0.005353579108) * y - 0.002141268741) * y
|
|
30
|
+
+ 0.000535310849) * y + 0.999936657524;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return z > 0.0 ? ((x + 1.0) * 0.5) : ((1.0 - x) * 0.5);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/* CRITZ -- Compute critical normal z value to
|
|
38
|
+
produce given p. We just do a bisection
|
|
39
|
+
search for a value within CHI_EPSILON,
|
|
40
|
+
relying on the monotonicity of pochisq(). */
|
|
41
|
+
|
|
42
|
+
export function critz(p: number) {
|
|
43
|
+
var Z_EPSILON = 0.000001; /* Accuracy of z approximation */
|
|
44
|
+
var minz = -Z_MAX;
|
|
45
|
+
var maxz = Z_MAX;
|
|
46
|
+
var zval = 0.0;
|
|
47
|
+
var pval;
|
|
48
|
+
if (p < 0.0) p = 0.0;
|
|
49
|
+
if (p > 1.0) p = 1.0;
|
|
50
|
+
|
|
51
|
+
while ((maxz - minz) > Z_EPSILON) {
|
|
52
|
+
pval = poz(zval);
|
|
53
|
+
if (pval > p) {
|
|
54
|
+
maxz = zval;
|
|
55
|
+
} else {
|
|
56
|
+
minz = zval;
|
|
57
|
+
}
|
|
58
|
+
zval = (maxz + minz) * 0.5;
|
|
59
|
+
}
|
|
60
|
+
return (zval);
|
|
61
61
|
}
|