querysub 0.437.0 → 0.439.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 +2 -2
- 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/0-path-value-core/archiveLocks/archiveSnapshots.ts +37 -1
- package/src/0-path-value-core/pathValueCore.ts +12 -0
- 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/PathFunctionRunner.ts +24 -13
- 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 +400 -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/PathDistributionInfo.tsx +9 -1
- package/src/diagnostics/listenOnDebugger.ts +71 -71
- package/src/diagnostics/logs/IndexedLogs/BufferUnitIndex.ts +1 -1
- package/src/diagnostics/logs/diskLogger.ts +6 -0
- package/src/diagnostics/misc-pages/SnapshotViewer.tsx +78 -1
- 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/library-components/uncaughtToast.tsx +2 -0
- 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
|
@@ -99,11 +99,9 @@ export class PathValueControllerBase {
|
|
|
99
99
|
}) {
|
|
100
100
|
let changes = config.pathValues;
|
|
101
101
|
let { nodeId, initialTriggers } = config;
|
|
102
|
-
let allowSource = await isNodeTrusted(nodeId) || getNodeIdIP(nodeId) === "127.0.0.1";
|
|
103
102
|
let buffers = await pathValueSerializer.serialize(changes, {
|
|
104
103
|
noLocks: true,
|
|
105
104
|
compress: getCompressNetwork(),
|
|
106
|
-
stripSource: !allowSource,
|
|
107
105
|
});
|
|
108
106
|
this.logSendValues({ nodeId, pathValues: changes, initialTriggers, });
|
|
109
107
|
return await PathValueController.nodes[nodeId].sendData({
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { sha256 } from "js-sha256";
|
|
2
2
|
import { getArchives } from "../../-a-archives/archives";
|
|
3
3
|
import { getAllNodeIds, getOwnThreadId } from "../../-f-node-discovery/NodeDiscovery";
|
|
4
|
-
import { pathValueArchives } from "../pathValueArchives";
|
|
4
|
+
import { archives, pathValueArchives } from "../pathValueArchives";
|
|
5
5
|
import { ignoreErrors, logErrors, timeoutToUndefinedSilent } from "../../errors";
|
|
6
6
|
import { green, magenta } from "socket-function/src/formatting/logColors";
|
|
7
7
|
import { devDebugbreak, isPublic } from "../../config";
|
|
8
8
|
import { sort } from "socket-function/src/misc";
|
|
9
9
|
import { lazy } from "socket-function/src/caching";
|
|
10
|
+
import { decodeCborx, encodeCborx } from "../../misc/cloneHelpers";
|
|
11
|
+
import { runInParallel } from "socket-function/src/batching";
|
|
12
|
+
import { formatNumber } from "socket-function/src/formatting/format";
|
|
10
13
|
|
|
11
14
|
const snapshots = lazy(() => getArchives("snapshots"));
|
|
12
15
|
|
|
@@ -140,6 +143,39 @@ async function getSnapshotBase(snapshotFile: string | "live") {
|
|
|
140
143
|
};
|
|
141
144
|
}
|
|
142
145
|
|
|
146
|
+
export interface ArchiveSnapshotPayloadFile {
|
|
147
|
+
path: string;
|
|
148
|
+
data: Buffer;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export async function downloadSnapshot(snapshotFile: string | "live"): Promise<Buffer> {
|
|
152
|
+
let { files } = await getSnapshotBase(snapshotFile);
|
|
153
|
+
let buffers = await pathValueArchives.getRawValueFiles(files, { includeRecycleBin: true });
|
|
154
|
+
let payload: ArchiveSnapshotPayloadFile[] = [];
|
|
155
|
+
for (let i = 0; i < files.length; i++) {
|
|
156
|
+
let data = buffers[i];
|
|
157
|
+
if (!data) continue;
|
|
158
|
+
payload.push({ path: files[i], data });
|
|
159
|
+
}
|
|
160
|
+
return encodeCborx(payload);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export async function uploadSnapshot(buffer: Buffer): Promise<ArchiveSnapshotOverview> {
|
|
164
|
+
let payload = decodeCborx<ArchiveSnapshotPayloadFile[]>(buffer);
|
|
165
|
+
let liveArchives = archives();
|
|
166
|
+
async function uploadFile(path: string, data: Buffer) {
|
|
167
|
+
let existing = await liveArchives.getInfo(path);
|
|
168
|
+
if (existing) return;
|
|
169
|
+
console.log(`Creating missing file (${formatNumber(data.length)}B): ${path}`);
|
|
170
|
+
await liveArchives.set(path, Buffer.from(data));
|
|
171
|
+
}
|
|
172
|
+
let parallel = runInParallel({
|
|
173
|
+
parallelCount: 32,
|
|
174
|
+
}, uploadFile);
|
|
175
|
+
await Promise.all(payload.map(file => parallel(file.path, file.data)));
|
|
176
|
+
return await saveSnapshot({ files: payload.map(x => x.path) });
|
|
177
|
+
}
|
|
178
|
+
|
|
143
179
|
// EXTREME DANGEROUS! Should only be done when all servers are down (except one, which
|
|
144
180
|
// is run on a developers machine). Worse case scenario, where everything is broken,
|
|
145
181
|
// and you need to just go back to a previous state.
|
|
@@ -394,6 +394,18 @@ export function debugPathValue(pathValue: PathValue, write?: boolean): string {
|
|
|
394
394
|
export function debugTime(time: Time): string {
|
|
395
395
|
return `${time.time}[${time.version}]@${time.creatorId.toString().slice(4, 12)}`;
|
|
396
396
|
}
|
|
397
|
+
export function parseDebugTime(debugTime: string): {
|
|
398
|
+
time: number;
|
|
399
|
+
version: number;
|
|
400
|
+
creatorIdPart: string;
|
|
401
|
+
} {
|
|
402
|
+
let parts = debugTime.split(/[\[\]\@]/g);
|
|
403
|
+
return {
|
|
404
|
+
time: +(parts[0]),
|
|
405
|
+
version: +(parts[1]),
|
|
406
|
+
creatorIdPart: parts[2],
|
|
407
|
+
};
|
|
408
|
+
}
|
|
397
409
|
|
|
398
410
|
|
|
399
411
|
let getCompressNetworkBase = () => false;
|