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
|
@@ -1,347 +1,401 @@
|
|
|
1
|
-
import { lazy } from "socket-function/src/caching";
|
|
2
|
-
import { ExternalRenderClass, __INTERNAL__QRenderClass, getSchemaPrefix, getSourceVSCodeLink, qreact, triggerRerenderAll } from "../4-dom/qreact";
|
|
3
|
-
import { blue, green, magenta, yellow } from "socket-function/src/formatting/logColors";
|
|
4
|
-
import { getPathFromStr, getPathStr } from "../path";
|
|
5
|
-
import { delay } from "socket-function/src/batching";
|
|
6
|
-
import { logErrors } from "../errors";
|
|
7
|
-
import { clientWatcher } from "../1-path-client/pathValueClientWatcher";
|
|
8
|
-
import { Querysub } from "../4-querysub/QuerysubController";
|
|
9
|
-
import { closeAllModals, showModal } from "./Modal";
|
|
10
|
-
import { FullscreenModal } from "./FullscreenModal";
|
|
11
|
-
import { css } from "typesafecss";
|
|
12
|
-
import { Button } from "../library-components/Button";
|
|
13
|
-
import { authorityStorage } from "../0-path-value-core/pathValueCore";
|
|
14
|
-
import { pathValueSerializer } from "../-h-path-value-serialize/PathValueSerializer";
|
|
15
|
-
import { PathValueProxyWatcher } from "../2-proxy/PathValueProxyWatcher";
|
|
16
|
-
import { InputLabel, InputLabelURL } from "../library-components/InputLabel";
|
|
17
|
-
import { URLParam } from "../library-components/URLParam";
|
|
18
|
-
import { hotReloadingGuard, isHotReloading, onHotReload } from "socket-function/hot/HotReloadController";
|
|
19
|
-
import { isCallerDynamicModule, isDynamicModule } from "../3-path-functions/pathFunctionLoader";
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
console.
|
|
110
|
-
console.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
let
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
component
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
<
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
1
|
+
import { lazy } from "socket-function/src/caching";
|
|
2
|
+
import { ExternalRenderClass, __INTERNAL__QRenderClass, getSchemaPrefix, getSourceVSCodeLink, qreact, triggerRerenderAll } from "../4-dom/qreact";
|
|
3
|
+
import { blue, green, magenta, yellow } from "socket-function/src/formatting/logColors";
|
|
4
|
+
import { getPathFromStr, getPathStr } from "../path";
|
|
5
|
+
import { delay } from "socket-function/src/batching";
|
|
6
|
+
import { logErrors } from "../errors";
|
|
7
|
+
import { clientWatcher } from "../1-path-client/pathValueClientWatcher";
|
|
8
|
+
import { Querysub } from "../4-querysub/QuerysubController";
|
|
9
|
+
import { closeAllModals, showModal } from "./Modal";
|
|
10
|
+
import { FullscreenModal, showFullscreenModal } from "./FullscreenModal";
|
|
11
|
+
import { css } from "typesafecss";
|
|
12
|
+
import { Button } from "../library-components/Button";
|
|
13
|
+
import { authorityStorage } from "../0-path-value-core/pathValueCore";
|
|
14
|
+
import { pathValueSerializer } from "../-h-path-value-serialize/PathValueSerializer";
|
|
15
|
+
import { PathValueProxyWatcher } from "../2-proxy/PathValueProxyWatcher";
|
|
16
|
+
import { InputLabel, InputLabelURL } from "../library-components/InputLabel";
|
|
17
|
+
import { URLParam } from "../library-components/URLParam";
|
|
18
|
+
import { hotReloadingGuard, isHotReloading, onHotReload } from "socket-function/hot/HotReloadController";
|
|
19
|
+
import { isCallerDynamicModule, isDynamicModule } from "../3-path-functions/pathFunctionLoader";
|
|
20
|
+
import { ATag } from "../library-components/ATag";
|
|
21
|
+
import { managementPageURL, showingManagementURL } from "../diagnostics/managementPages";
|
|
22
|
+
import { endTimeParam, startTimeParam } from "../diagnostics/logs/TimeRangeSelector";
|
|
23
|
+
import { timeInHour } from "socket-function/src/misc";
|
|
24
|
+
import { additionalSearchURL, lifecycleIdURL } from "../diagnostics/logs/lifeCycleAnalysis/LifeCyclePage";
|
|
25
|
+
import { parseDebugName } from "../3-path-functions/PathFunctionRunner";
|
|
26
|
+
|
|
27
|
+
// Map, so hot reloading doesn't break things
|
|
28
|
+
let componentButtons = new Map<string, { title: string, callback: (component: ExternalRenderClass) => void }>();
|
|
29
|
+
let componentUIs = new Map<string, (component: ExternalRenderClass) => qreact.ComponentChildren>();
|
|
30
|
+
|
|
31
|
+
export function addComponentButton(config: {
|
|
32
|
+
title: string;
|
|
33
|
+
callback: (component: ExternalRenderClass) => void;
|
|
34
|
+
}) {
|
|
35
|
+
if (isCallerDynamicModule()) return;
|
|
36
|
+
if (!isHotReloading() && componentButtons.has(config.title)) {
|
|
37
|
+
throw new Error(`Component button with title ${config.title} already exists`);
|
|
38
|
+
}
|
|
39
|
+
componentButtons.set(config.title, config);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function addComponentUI(config: {
|
|
43
|
+
key: string;
|
|
44
|
+
createUI: (component: ExternalRenderClass) => qreact.ComponentChildren;
|
|
45
|
+
}) {
|
|
46
|
+
if (isCallerDynamicModule()) return;
|
|
47
|
+
if (!isHotReloading() && componentUIs.has(config.key)) {
|
|
48
|
+
throw new Error(`Component UI with key ${config.key} already exists`);
|
|
49
|
+
}
|
|
50
|
+
componentUIs.set(config.key, config.createUI);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const enableDebugComponents = lazy(function enableDebugComponents() {
|
|
54
|
+
console.log(magenta(`middleclick + shift on components to debug them`));
|
|
55
|
+
// mousedown is more reliable than click, because the click will be aborted if they middle click
|
|
56
|
+
// in something with a scrollbar.
|
|
57
|
+
document.addEventListener("mousedown", function (e) {
|
|
58
|
+
// Middle click to debug
|
|
59
|
+
if (e.button === 1 && (e.altKey || e.shiftKey)) {
|
|
60
|
+
logErrors(triggerDebug(e.target as HTMLElement, e));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
async function triggerDebug(target: HTMLElement, event: MouseEvent) {
|
|
65
|
+
const component = __INTERNAL__QRenderClass.getInstanceFromDOM(target);
|
|
66
|
+
if (!component) return;
|
|
67
|
+
event.preventDefault();
|
|
68
|
+
event.stopPropagation();
|
|
69
|
+
|
|
70
|
+
let prevInject = qreact.INJECT_LINE_NUMBERS;
|
|
71
|
+
try {
|
|
72
|
+
qreact.INJECT_LINE_NUMBERS = true;
|
|
73
|
+
triggerRerenderAll();
|
|
74
|
+
await clientWatcher.waitForTriggerFinished();
|
|
75
|
+
} finally {
|
|
76
|
+
qreact.INJECT_LINE_NUMBERS = prevInject;
|
|
77
|
+
}
|
|
78
|
+
// Get new target under the mouse
|
|
79
|
+
target = document.elementFromPoint(event.clientX, event.clientY) as HTMLElement;
|
|
80
|
+
|
|
81
|
+
let source = getSourceVSCodeLink(target);
|
|
82
|
+
if (event.shiftKey) {
|
|
83
|
+
let newComponent = __INTERNAL__QRenderClass.getInstanceFromDOM(target) || component;
|
|
84
|
+
let doClose: { close: boolean } = { close: false };
|
|
85
|
+
showModal({
|
|
86
|
+
content: <WatchModal component={newComponent} doClose={doClose} />,
|
|
87
|
+
onClose: () => doClose.close ? undefined : "abortClose"
|
|
88
|
+
});
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
let ancestors = component.getDebugComponentStack().slice(1).reverse();
|
|
93
|
+
let schemaPrefix = getSchemaPrefix();
|
|
94
|
+
let schemaLength = getPathFromStr(schemaPrefix).length;
|
|
95
|
+
function encodePath(pathStr: string) {
|
|
96
|
+
let path = getPathFromStr(pathStr);
|
|
97
|
+
if (pathStr.startsWith(schemaPrefix)) {
|
|
98
|
+
let underPath = path.slice(schemaLength);
|
|
99
|
+
let componentId = Number(underPath[0]);
|
|
100
|
+
let component = __INTERNAL__QRenderClass.getInstanceAllowedUndefined(componentId);
|
|
101
|
+
if (component) {
|
|
102
|
+
path = [component.debugName].concat(underPath.slice(1));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// If paths are to other components, replace the prefix with the component debugName
|
|
106
|
+
return path.map(x => green(x)).join(".");
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
console.log(" ");
|
|
110
|
+
console.log(" ");
|
|
111
|
+
console.log(" ");
|
|
112
|
+
if (event.altKey) {
|
|
113
|
+
window.open(source);
|
|
114
|
+
}
|
|
115
|
+
// VSCode link
|
|
116
|
+
if (source) {
|
|
117
|
+
console.log(source);
|
|
118
|
+
}
|
|
119
|
+
console.group(`Component ${blue(component.debugName)}`);
|
|
120
|
+
console.groupCollapsed(` Ancestors (${ancestors.length})`);
|
|
121
|
+
for (let ancestor of ancestors) {
|
|
122
|
+
console.log(" " + ancestor.debugName);
|
|
123
|
+
let source = ancestor.getVSCodeLink();
|
|
124
|
+
if (source) {
|
|
125
|
+
console.log(` ${source}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
console.groupEnd();
|
|
129
|
+
let lastWatches = component.renderWatcher!.lastWatches;
|
|
130
|
+
|
|
131
|
+
let watchPaths = Array.from(lastWatches.paths).filter(x => getPathFromStr(x).length > schemaLength);
|
|
132
|
+
console.groupCollapsed(` Watches (${watchPaths.length}):`);
|
|
133
|
+
for (let key of watchPaths) {
|
|
134
|
+
console.log(" " + encodePath(key));
|
|
135
|
+
}
|
|
136
|
+
console.groupEnd();
|
|
137
|
+
|
|
138
|
+
let parentPaths = Array.from(lastWatches.parentPaths).filter(x => getPathFromStr(x).length > schemaLength);
|
|
139
|
+
if (parentPaths.length > 0) {
|
|
140
|
+
console.groupCollapsed(` Parent Watches (${parentPaths.length}):`);
|
|
141
|
+
for (let key of parentPaths) {
|
|
142
|
+
if (getPathFromStr(key).length <= schemaLength) continue;
|
|
143
|
+
console.log(" " + encodePath(key));
|
|
144
|
+
}
|
|
145
|
+
console.groupEnd();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
console.log(` debugHolder = `, component);
|
|
149
|
+
(globalThis as any).debugHolder = component;
|
|
150
|
+
console.log(` debugInstance`, component.instance);
|
|
151
|
+
(globalThis as any).debugInstance = component.instance;
|
|
152
|
+
|
|
153
|
+
console.groupEnd();
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
const pathFilter = new URLParam("pathfilter", "");
|
|
159
|
+
class WatchModal extends qreact.Component<{
|
|
160
|
+
component: ExternalRenderClass;
|
|
161
|
+
doClose: { close: boolean };
|
|
162
|
+
}> {
|
|
163
|
+
state = {
|
|
164
|
+
parentNavigate: 0,
|
|
165
|
+
pos: "fill" as "top" | "fill" | "bottom",
|
|
166
|
+
};
|
|
167
|
+
componentDidMount() {
|
|
168
|
+
document.addEventListener("keydown", this.keyDown, true);
|
|
169
|
+
Querysub.onDispose(() => {
|
|
170
|
+
document.removeEventListener("keydown", this.keyDown, true);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
keyDown = (e: KeyboardEvent) => {
|
|
174
|
+
if (e.key === "Escape") {
|
|
175
|
+
Querysub.commit(() => {
|
|
176
|
+
this.props.doClose.close = true;
|
|
177
|
+
closeAllModals();
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
render() {
|
|
182
|
+
let component = this.props.component;
|
|
183
|
+
for (let i = 0; i < this.state.parentNavigate; i++) {
|
|
184
|
+
component = component.getParent() || component;
|
|
185
|
+
}
|
|
186
|
+
let lastWatches = component.renderWatcher?.lastWatches || {
|
|
187
|
+
paths: new Set(),
|
|
188
|
+
parentPaths: new Set(),
|
|
189
|
+
};
|
|
190
|
+
let parent: ExternalRenderClass | undefined;
|
|
191
|
+
try {
|
|
192
|
+
parent = component.getParent();
|
|
193
|
+
} catch (e) {
|
|
194
|
+
console.log(`Failed to get parent`, e);
|
|
195
|
+
}
|
|
196
|
+
function nicerPath(path: string[]) {
|
|
197
|
+
if (path[1] === "PathFunctionRunner") {
|
|
198
|
+
path.splice(1, 1);
|
|
199
|
+
}
|
|
200
|
+
return path;
|
|
201
|
+
}
|
|
202
|
+
let pos = this.state.pos;
|
|
203
|
+
let filter = pathFilter.value.toLowerCase();
|
|
204
|
+
return (
|
|
205
|
+
<div
|
|
206
|
+
style={{
|
|
207
|
+
position: "fixed",
|
|
208
|
+
top: 0,
|
|
209
|
+
left: 0,
|
|
210
|
+
width: "100vw",
|
|
211
|
+
height: "100vh",
|
|
212
|
+
padding: 100,
|
|
213
|
+
display: "flex",
|
|
214
|
+
alignItems: "center",
|
|
215
|
+
justifyContent: "center",
|
|
216
|
+
overflow: "auto",
|
|
217
|
+
...(pos === "fill" && {}
|
|
218
|
+
|| pos === "top" && { height: "25vh", padding: 10 }
|
|
219
|
+
|| pos === "bottom" && { height: "25vh", padding: 10, top: undefined, bottom: 0 }
|
|
220
|
+
|| {}),
|
|
221
|
+
}}>
|
|
222
|
+
<div
|
|
223
|
+
className="keepModalsOpen"
|
|
224
|
+
style={{
|
|
225
|
+
background: "hsl(0, 0%, 100%)",
|
|
226
|
+
padding: 20,
|
|
227
|
+
color: "hsl(0, 0%, 7%)",
|
|
228
|
+
cursor: "default",
|
|
229
|
+
width: "100%",
|
|
230
|
+
display: "flex",
|
|
231
|
+
flexDirection: "column",
|
|
232
|
+
gap: 10,
|
|
233
|
+
height: "100%",
|
|
234
|
+
overflow: "auto",
|
|
235
|
+
}}
|
|
236
|
+
>
|
|
237
|
+
<div class={css.hsl(0, 0, 100).hslcolor(0, 0, 10).vbox(6).fillBoth}>
|
|
238
|
+
<div class={css.hbox(10).fillWidth}>
|
|
239
|
+
{component.debugName}
|
|
240
|
+
{parent && <Button onClick={() => this.state.parentNavigate++}>
|
|
241
|
+
Go to parent ({parent.debugName})
|
|
242
|
+
</Button>}
|
|
243
|
+
{this.state.parentNavigate > 0 && <Button onClick={() => this.state.parentNavigate--}>
|
|
244
|
+
Child
|
|
245
|
+
</Button>}
|
|
246
|
+
<div class={css.marginAuto} />
|
|
247
|
+
<Button onClick={() => this.state.pos = "top"}>
|
|
248
|
+
Top
|
|
249
|
+
</Button>
|
|
250
|
+
<Button onClick={() => this.state.pos = "fill"}>
|
|
251
|
+
Fill
|
|
252
|
+
</Button>
|
|
253
|
+
<Button onClick={() => this.state.pos = "bottom"}>
|
|
254
|
+
Bottom
|
|
255
|
+
</Button>
|
|
256
|
+
<Button onClick={() => {
|
|
257
|
+
this.props.doClose.close = true;
|
|
258
|
+
closeAllModals();
|
|
259
|
+
}}>
|
|
260
|
+
Close
|
|
261
|
+
</Button>
|
|
262
|
+
</div>
|
|
263
|
+
|
|
264
|
+
<div class={css.hbox(8)}>
|
|
265
|
+
<Button onClick={() => component.instance.forceUpdate()}>
|
|
266
|
+
Rerender
|
|
267
|
+
</Button>
|
|
268
|
+
{Array.from(componentButtons.values()).map(({ title, callback }) => (
|
|
269
|
+
<Button onClick={() => callback(component)}>
|
|
270
|
+
{title}
|
|
271
|
+
</Button>
|
|
272
|
+
))}
|
|
273
|
+
</div>
|
|
274
|
+
{Array.from(componentUIs.values()).map((createUI) => createUI(component))}
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
<InputLabelURL hot label="Filter" url={pathFilter} />
|
|
278
|
+
|
|
279
|
+
<h4>Parent Paths ({lastWatches.parentPaths.size})</h4>
|
|
280
|
+
<div class={css.vbox(2)}>
|
|
281
|
+
{Array.from(lastWatches.parentPaths).map(path =>
|
|
282
|
+
<div class={css.hbox(4).wrap.button} onClick={() => {
|
|
283
|
+
console.log(path);
|
|
284
|
+
return navigator.clipboard.writeText(path);
|
|
285
|
+
}}>
|
|
286
|
+
{nicerPath(getPathFromStr(path)).map(x => <span class={css.pad2(3, 0).hsl(0, 0, 80)}>{x}</span>)}
|
|
287
|
+
|
|
288
|
+
<span class={css.pad2(3, 2).hsl(180, 75, 75)}>({authorityStorage.getPathsFromParent(path)?.size})</span>
|
|
289
|
+
</div>
|
|
290
|
+
)}
|
|
291
|
+
</div>
|
|
292
|
+
<h4>Paths ({lastWatches.paths.size})</h4>
|
|
293
|
+
<div class={css.vbox(2).fillBoth.overflowAuto}>
|
|
294
|
+
{Array.from(lastWatches.paths).map(path => {
|
|
295
|
+
if (filter && !path.toLowerCase().includes(filter)) {
|
|
296
|
+
return undefined;
|
|
297
|
+
}
|
|
298
|
+
let valueObj = authorityStorage.getValueAtTime(path);
|
|
299
|
+
let value = pathValueSerializer.getPathValue(valueObj);
|
|
300
|
+
let valueStr = String(value);
|
|
301
|
+
try {
|
|
302
|
+
valueStr = String(JSON.stringify(value));
|
|
303
|
+
} catch { }
|
|
304
|
+
if (valueStr === "undefined" && typeof value === "function") {
|
|
305
|
+
valueStr = String(value).slice(0, 100);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (valueStr.length > 500) {
|
|
309
|
+
valueStr = valueStr.slice(0, 500);
|
|
310
|
+
}
|
|
311
|
+
let pathArray = nicerPath(getPathFromStr(path));
|
|
312
|
+
let breakOnWrites = PathValueProxyWatcher.BREAK_ON_WRITES.has(path);
|
|
313
|
+
let breakOnReads = PathValueProxyWatcher.BREAK_ON_READS.has(path);
|
|
314
|
+
let logOnRead = PathValueProxyWatcher.LOG_WRITES_INCLUDES.has(path);
|
|
315
|
+
let fncBreak = PathValueProxyWatcher.SET_FUNCTION_WATCH_ON_WRITES.has(path);
|
|
316
|
+
let selectedButton = css.hsl(120, 75, 75);
|
|
317
|
+
|
|
318
|
+
let sourceObj = parseDebugName(valueObj?.source || "");
|
|
319
|
+
|
|
320
|
+
return (
|
|
321
|
+
<div class={css.hbox(10, 0).fillWidth.wrap}>
|
|
322
|
+
<button class={breakOnWrites && selectedButton || ""} onClick={() => {
|
|
323
|
+
if (breakOnWrites) {
|
|
324
|
+
PathValueProxyWatcher.BREAK_ON_WRITES.delete(path);
|
|
325
|
+
} else {
|
|
326
|
+
PathValueProxyWatcher.BREAK_ON_WRITES.add(path);
|
|
327
|
+
}
|
|
328
|
+
this.forceUpdate();
|
|
329
|
+
}}>
|
|
330
|
+
=
|
|
331
|
+
</button>
|
|
332
|
+
<button class={breakOnReads && selectedButton || ""} onClick={() => {
|
|
333
|
+
if (breakOnReads) {
|
|
334
|
+
PathValueProxyWatcher.BREAK_ON_READS.delete(path);
|
|
335
|
+
} else {
|
|
336
|
+
PathValueProxyWatcher.BREAK_ON_READS.add(path);
|
|
337
|
+
}
|
|
338
|
+
this.forceUpdate();
|
|
339
|
+
}}>
|
|
340
|
+
===
|
|
341
|
+
</button>
|
|
342
|
+
<button class={logOnRead && selectedButton || ""} onClick={() => {
|
|
343
|
+
if (logOnRead) {
|
|
344
|
+
PathValueProxyWatcher.LOG_WRITES_INCLUDES.delete(path);
|
|
345
|
+
} else {
|
|
346
|
+
PathValueProxyWatcher.LOG_WRITES_INCLUDES.add(path);
|
|
347
|
+
}
|
|
348
|
+
this.forceUpdate();
|
|
349
|
+
}}>
|
|
350
|
+
Log
|
|
351
|
+
</button>
|
|
352
|
+
<button class={fncBreak && selectedButton || ""} title="Breaks on the caller of the function that mutates this. Only works on the second call (and only if the function is input predicted)." onClick={() => {
|
|
353
|
+
if (breakOnWrites) {
|
|
354
|
+
PathValueProxyWatcher.SET_FUNCTION_WATCH_ON_WRITES.delete(path);
|
|
355
|
+
} else {
|
|
356
|
+
PathValueProxyWatcher.SET_FUNCTION_WATCH_ON_WRITES.add(path);
|
|
357
|
+
}
|
|
358
|
+
this.forceUpdate();
|
|
359
|
+
}}>
|
|
360
|
+
Caller*
|
|
361
|
+
</button>
|
|
362
|
+
{
|
|
363
|
+
valueObj && sourceObj && <ATag values={[
|
|
364
|
+
showingManagementURL.getOverride(true),
|
|
365
|
+
managementPageURL.getOverride("LifeCyclePage"),
|
|
366
|
+
startTimeParam.getOverride(valueObj.time.time - timeInHour),
|
|
367
|
+
endTimeParam.getOverride(valueObj.time.time + timeInHour),
|
|
368
|
+
lifecycleIdURL.getOverride("1772917451506.018_0.441679673600166"),
|
|
369
|
+
additionalSearchURL.getOverride(`${sourceObj.functionId} & ${sourceObj.runAtTime.time}`),
|
|
370
|
+
]}
|
|
371
|
+
title={valueObj.source || ""}
|
|
372
|
+
>
|
|
373
|
+
View Call
|
|
374
|
+
</ATag>
|
|
375
|
+
|| <div title={valueObj?.source || ""}>
|
|
376
|
+
Source
|
|
377
|
+
</div>
|
|
378
|
+
}
|
|
379
|
+
<div class={css.hbox(4).wrap.button} onClick={() => {
|
|
380
|
+
console.log(path);
|
|
381
|
+
return navigator.clipboard.writeText(path);
|
|
382
|
+
}}>
|
|
383
|
+
{pathArray.map((x, index) => <span class={css.pad2(3, 2).hsl(0, 0, 80)}>
|
|
384
|
+
{x}
|
|
385
|
+
</span>)}
|
|
386
|
+
</div>
|
|
387
|
+
<div class={css.pad2(3, 2).hsl(180, 75, 75).ellipsis.button} onClick={() => {
|
|
388
|
+
console.log(value);
|
|
389
|
+
}}>
|
|
390
|
+
{valueStr}
|
|
391
|
+
</div>
|
|
392
|
+
</div>
|
|
393
|
+
);
|
|
394
|
+
})}
|
|
395
|
+
</div>
|
|
396
|
+
</div>
|
|
397
|
+
</div>
|
|
398
|
+
</div>
|
|
399
|
+
);
|
|
400
|
+
}
|
|
347
401
|
}
|