querysub 0.433.0 → 0.437.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/pathValueCore.ts +2 -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 +346 -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,77 +1,77 @@
|
|
|
1
|
-
import { SocketFunction } from "socket-function/SocketFunction";
|
|
2
|
-
import { delay } from "socket-function/src/batching";
|
|
3
|
-
import { getThreadKeyCert } from "../../-a-auth/certs";
|
|
4
|
-
import { ActionsHistory } from "../../diagnostics/ActionsHistory";
|
|
5
|
-
import { errorToUndefined } from "../../errors";
|
|
6
|
-
import { rawSchema } from "../../2-proxy/pathDatabaseProxyBase";
|
|
7
|
-
import { ClientWatcher, clientWatcher } from "../../1-path-client/pathValueClientWatcher";
|
|
8
|
-
import { PathValueProxyWatcher, proxyWatcher } from "../../2-proxy/PathValueProxyWatcher";
|
|
9
|
-
import { pathValueCommitter } from "../../0-path-value-core/PathValueController";
|
|
10
|
-
import { getNextTime } from "../../0-path-value-core/pathValueCore";
|
|
11
|
-
import { PathFunctionRunner } from "../PathFunctionRunner";
|
|
12
|
-
|
|
13
|
-
export const schema = rawSchema<{
|
|
14
|
-
["querysub.com"]: {
|
|
15
|
-
rejectTest: {
|
|
16
|
-
value: number;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
}>();
|
|
20
|
-
|
|
21
|
-
async function reader() {
|
|
22
|
-
await proxyWatcher.createWatcher({
|
|
23
|
-
debugName: "reader",
|
|
24
|
-
watchFunction() {
|
|
25
|
-
console.log(`Reader sees ${JSON.stringify(schema()["querysub.com"].rejectTest.value)}`);
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
async function badWriter() {
|
|
30
|
-
let time = getNextTime();
|
|
31
|
-
console.log(`Saving time`);
|
|
32
|
-
await delay(10 * 1000);
|
|
33
|
-
console.log(`Applying write`);
|
|
34
|
-
await proxyWatcher.commitFunction({
|
|
35
|
-
debugName: "badWriter",
|
|
36
|
-
runAtTime: time,
|
|
37
|
-
canWrite: true,
|
|
38
|
-
watchFunction() {
|
|
39
|
-
schema()["querysub.com"].rejectTest.value += 2;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
async function writer() {
|
|
44
|
-
await proxyWatcher.commitFunction({
|
|
45
|
-
debugName: "badWriter",
|
|
46
|
-
canWrite: true,
|
|
47
|
-
watchFunction() {
|
|
48
|
-
schema()["querysub.com"].rejectTest.value++;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async function main() {
|
|
54
|
-
ClientWatcher.DEBUG_READS = true;
|
|
55
|
-
ClientWatcher.DEBUG_WRITES = true;
|
|
56
|
-
PathValueProxyWatcher.TRACE = true;
|
|
57
|
-
PathFunctionRunner.DEBUG_CALLS = true;
|
|
58
|
-
|
|
59
|
-
await SocketFunction.mount({ port: 0, ...await getThreadKeyCert() });
|
|
60
|
-
if (process.argv.includes("--reader")) {
|
|
61
|
-
ActionsHistory.LOG_ACTION_HISTORY = "reader";
|
|
62
|
-
await reader();
|
|
63
|
-
await new Promise(() => { });
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (process.argv.includes("--bad")) {
|
|
67
|
-
ActionsHistory.LOG_ACTION_HISTORY = "bad";
|
|
68
|
-
await badWriter();
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
ActionsHistory.LOG_ACTION_HISTORY = "writer";
|
|
72
|
-
await writer();
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
errorToUndefined(main())
|
|
76
|
-
.finally(() => pathValueCommitter.waitForValuesToCommit())
|
|
1
|
+
import { SocketFunction } from "socket-function/SocketFunction";
|
|
2
|
+
import { delay } from "socket-function/src/batching";
|
|
3
|
+
import { getThreadKeyCert } from "../../-a-auth/certs";
|
|
4
|
+
import { ActionsHistory } from "../../diagnostics/ActionsHistory";
|
|
5
|
+
import { errorToUndefined } from "../../errors";
|
|
6
|
+
import { rawSchema } from "../../2-proxy/pathDatabaseProxyBase";
|
|
7
|
+
import { ClientWatcher, clientWatcher } from "../../1-path-client/pathValueClientWatcher";
|
|
8
|
+
import { PathValueProxyWatcher, proxyWatcher } from "../../2-proxy/PathValueProxyWatcher";
|
|
9
|
+
import { pathValueCommitter } from "../../0-path-value-core/PathValueController";
|
|
10
|
+
import { getNextTime } from "../../0-path-value-core/pathValueCore";
|
|
11
|
+
import { PathFunctionRunner } from "../PathFunctionRunner";
|
|
12
|
+
|
|
13
|
+
export const schema = rawSchema<{
|
|
14
|
+
["querysub.com"]: {
|
|
15
|
+
rejectTest: {
|
|
16
|
+
value: number;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}>();
|
|
20
|
+
|
|
21
|
+
async function reader() {
|
|
22
|
+
await proxyWatcher.createWatcher({
|
|
23
|
+
debugName: "reader",
|
|
24
|
+
watchFunction() {
|
|
25
|
+
console.log(`Reader sees ${JSON.stringify(schema()["querysub.com"].rejectTest.value)}`);
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async function badWriter() {
|
|
30
|
+
let time = getNextTime();
|
|
31
|
+
console.log(`Saving time`);
|
|
32
|
+
await delay(10 * 1000);
|
|
33
|
+
console.log(`Applying write`);
|
|
34
|
+
await proxyWatcher.commitFunction({
|
|
35
|
+
debugName: "badWriter",
|
|
36
|
+
runAtTime: time,
|
|
37
|
+
canWrite: true,
|
|
38
|
+
watchFunction() {
|
|
39
|
+
schema()["querysub.com"].rejectTest.value += 2;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
async function writer() {
|
|
44
|
+
await proxyWatcher.commitFunction({
|
|
45
|
+
debugName: "badWriter",
|
|
46
|
+
canWrite: true,
|
|
47
|
+
watchFunction() {
|
|
48
|
+
schema()["querysub.com"].rejectTest.value++;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function main() {
|
|
54
|
+
ClientWatcher.DEBUG_READS = true;
|
|
55
|
+
ClientWatcher.DEBUG_WRITES = true;
|
|
56
|
+
PathValueProxyWatcher.TRACE = true;
|
|
57
|
+
PathFunctionRunner.DEBUG_CALLS = true;
|
|
58
|
+
|
|
59
|
+
await SocketFunction.mount({ port: 0, ...await getThreadKeyCert() });
|
|
60
|
+
if (process.argv.includes("--reader")) {
|
|
61
|
+
ActionsHistory.LOG_ACTION_HISTORY = "reader";
|
|
62
|
+
await reader();
|
|
63
|
+
await new Promise(() => { });
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (process.argv.includes("--bad")) {
|
|
67
|
+
ActionsHistory.LOG_ACTION_HISTORY = "bad";
|
|
68
|
+
await badWriter();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
ActionsHistory.LOG_ACTION_HISTORY = "writer";
|
|
72
|
+
await writer();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
errorToUndefined(main())
|
|
76
|
+
.finally(() => pathValueCommitter.waitForValuesToCommit())
|
|
77
77
|
.finally(() => process.exit());
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
let isDeployValue = false;
|
|
2
|
-
export function setIsDeploy() {
|
|
3
|
-
isDeployValue = true;
|
|
4
|
-
}
|
|
5
|
-
export function isDeploy() {
|
|
6
|
-
return isDeployValue;
|
|
1
|
+
let isDeployValue = false;
|
|
2
|
+
export function setIsDeploy() {
|
|
3
|
+
isDeployValue = true;
|
|
4
|
+
}
|
|
5
|
+
export function isDeploy() {
|
|
6
|
+
return isDeployValue;
|
|
7
7
|
}
|
package/src/4-dom/css.tsx
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { isNode } from "socket-function/src/misc";
|
|
2
|
-
import type { LengthOrPercentage, StrictStyles } from "./cssTypes";
|
|
3
|
-
import { css } from "typesafecss";
|
|
4
|
-
export { css };
|
|
5
|
-
|
|
6
|
-
export function setCSS(module: NodeJS.Module, text: string) {
|
|
7
|
-
if (isNode()) return;
|
|
8
|
-
let id = "css-" + module.id;
|
|
9
|
-
let style = document.getElementById(id);
|
|
10
|
-
if (!style) {
|
|
11
|
-
style = document.createElement("style");
|
|
12
|
-
document.head.appendChild(style);
|
|
13
|
-
style.id = "css-" + module.id;
|
|
14
|
-
}
|
|
15
|
-
style.innerHTML = text;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function className(strings: TemplateStringsArray, ...variables: unknown[]) {
|
|
19
|
-
let result = "";
|
|
20
|
-
for (let i = 0; i < strings.length; i++) {
|
|
21
|
-
result += strings[i];
|
|
22
|
-
let varValue = variables[i];
|
|
23
|
-
if (varValue || varValue === 0) {
|
|
24
|
-
result += String(varValue);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
// Remove extra whitespace and newlines, for readability
|
|
28
|
-
return result.replace(/\n/g, " ").replace(/ +/g, " ");
|
|
29
|
-
}
|
|
1
|
+
import { isNode } from "socket-function/src/misc";
|
|
2
|
+
import type { LengthOrPercentage, StrictStyles } from "./cssTypes";
|
|
3
|
+
import { css } from "typesafecss";
|
|
4
|
+
export { css };
|
|
5
|
+
|
|
6
|
+
export function setCSS(module: NodeJS.Module, text: string) {
|
|
7
|
+
if (isNode()) return;
|
|
8
|
+
let id = "css-" + module.id;
|
|
9
|
+
let style = document.getElementById(id);
|
|
10
|
+
if (!style) {
|
|
11
|
+
style = document.createElement("style");
|
|
12
|
+
document.head.appendChild(style);
|
|
13
|
+
style.id = "css-" + module.id;
|
|
14
|
+
}
|
|
15
|
+
style.innerHTML = text;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function className(strings: TemplateStringsArray, ...variables: unknown[]) {
|
|
19
|
+
let result = "";
|
|
20
|
+
for (let i = 0; i < strings.length; i++) {
|
|
21
|
+
result += strings[i];
|
|
22
|
+
let varValue = variables[i];
|
|
23
|
+
if (varValue || varValue === 0) {
|
|
24
|
+
result += String(varValue);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// Remove extra whitespace and newlines, for readability
|
|
28
|
+
return result.replace(/\n/g, " ").replace(/ +/g, " ");
|
|
29
|
+
}
|