querysub 0.341.0 → 0.343.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "querysub",
3
- "version": "0.341.0",
3
+ "version": "0.343.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
@@ -1071,7 +1071,7 @@ export class PathValueProxyWatcher {
1071
1071
  let runLeeway = MAX_ACCEPTED_CHANGE_AGE * 0.8;
1072
1072
  let runCutoffTime = Date.now() - runLeeway;
1073
1073
  if (options.runAtTime && options.runAtTime.time < runCutoffTime) {
1074
- let message = `MAX_CHANGE_AGE_EXCEEDED! Cannot run watcher at time ${options.runAtTime.time} because it is older than the cutOff time of ${runCutoffTime}. Writing this far in the past would break things, and might be rejected by other authorities due to being too old.`;
1074
+ let message = `MAX_CHANGE_AGE_EXCEEDED! Cannot run watcher ${options.debugName} at time ${options.runAtTime.time} because it is older than the cutOff time of ${runCutoffTime}. Writing this far in the past would break things, and might be rejected by other authorities due to being too old.`;
1075
1075
  console.error(red(message));
1076
1076
  // NOTE: We could also adjust the to be more recent, to allow it to be commited anyway,
1077
1077
  // in a slightly different state than originally expected.
@@ -1181,9 +1181,6 @@ export class PathValueProxyWatcher {
1181
1181
  };
1182
1182
  const getReadyToCommit = () => {
1183
1183
  let blocked = isProxyBlockedByOrder(watcher);
1184
- if (blocked) {
1185
- console.info(`Proxy ${watcher.debugName} is blocked by order`);
1186
- }
1187
1184
  return (
1188
1185
  watcher.lastUnsyncedAccesses.size === 0
1189
1186
  && watcher.lastUnsyncedParentAccesses.size === 0
@@ -2419,7 +2416,7 @@ const finishProxyAndTriggerNext = runInSerial(
2419
2416
  let next = proxiesOrdered[index];
2420
2417
  // Only trigger if it's the first entry and therefore it won't be blocked by the previous proxy, or, of course, if it's from a timeout, In which case, it won't be blocked anyway.
2421
2418
  if (next && (index === 0 || fromTimeout)) {
2422
- console.info(`Triggering next proxy in order: ${next.debugName}`, next.options.baseFunction || next.options.watchFunction);
2419
+ //console.info(`Triggering next proxy in order: ${next.debugName}`, next.options.baseFunction || next.options.watchFunction);
2423
2420
  next.explicitlyTrigger({
2424
2421
  newParentsSynced: new Set(),
2425
2422
  pathSources: new Set(),
@@ -520,7 +520,6 @@ export class PathFunctionRunner {
520
520
  runCount++;
521
521
  if (PathFunctionRunner.DEBUG_CALLS) {
522
522
  console.log(`Evaluating (try count ${runCount}) ${getDebugName(callPath, functionSpec, true)}`);
523
- console.log(` RUNNING AT REAL TIME ${debugTime(proxyWatcher.getTriggeredWatcher().currentReadTime || callPath.runAtTime)}`);
524
523
  }
525
524
  if (PathFunctionRunner.DEBUG_CALL_TRIGGERS && runCount > PathFunctionRunner.DEBUG_WATCHES_THRESHOLD) {
526
525
  // NOTE: If this happens a few times during initial loading it is fine. If it happens a lot... and with values MUCH
@@ -672,7 +671,7 @@ export class PathFunctionRunner {
672
671
  }
673
672
 
674
673
  if (PathFunctionRunner.DEBUG_CALLS) {
675
- console.log(`FINISHED${nooped ? " (skipped)" : ""} ${getDebugName(callPath, functionSpec, true)}, writes: ${finalWrites?.length}`);
674
+ console.log(`FINISHED${nooped ? " (skipped)" : ""} ${getDebugName(callPath, functionSpec, true)}, writes: ${finalWrites?.length}, took ${blue(formatTime(Date.now() - startTime))}`);
676
675
  }
677
676
 
678
677
  let wallTime = Date.now() - startTime;
@@ -30,7 +30,7 @@ async function main() {
30
30
  //ActionsHistory.LOG_ACTION_HISTORY = "runner";
31
31
 
32
32
  // ClientWatcher.DEBUG_READS = true;
33
- ClientWatcher.DEBUG_WRITES = true;
33
+ //ClientWatcher.DEBUG_WRITES = true;
34
34
  // ClientWatcher.DEBUG_TRIGGERS = "heavy";
35
35
  // authorityStorage.DEBUG_UNWATCH = true;
36
36
 
@@ -2436,7 +2436,7 @@ export function getSourceVSCodeLink(element: DOMNode | undefined) {
2436
2436
  Command palette: You can trigger VS Code commands using vscode://file/{file}?command={commandId}.
2437
2437
  Extensions: Some VS Code extensions may add support for additional URL parameters.
2438
2438
  */
2439
- let path = `cursor://file/${sourceInfo.sourceFileName}`;
2439
+ let path = `cursor://file${new URL(sourceInfo.sourceFileName).pathname}`;
2440
2440
  if (sourceInfo.lineNumber) {
2441
2441
  path += `:${sourceInfo.lineNumber}:${sourceInfo.columnNumber}`;
2442
2442
  path += `?selection=${sourceInfo.lineNumber},${sourceInfo.columnNumber}`;
@@ -53,6 +53,8 @@ import { parseArgsFactory } from "../misc/rawParams";
53
53
 
54
54
  import * as typesafecss from "typesafecss";
55
55
  import "../library-components/urlResetGroups";
56
+ import { createLocalSchema } from "./schemaHelpers";
57
+
56
58
 
57
59
 
58
60
  typesafecss.setMeasureBlock(measureBlock);
@@ -1069,32 +1071,6 @@ export class Querysub {
1069
1071
  // like just relying on the automatic checking is better?
1070
1072
  }
1071
1073
 
1072
- let localSchemaNames = new Set<string>();
1073
- function createLocalSchema<T>(name: string): () => T;
1074
- function createLocalSchema<SchemaDef extends Schema2>(name: string, schema: SchemaDef): () => Schema2T<SchemaDef>;
1075
- function createLocalSchema<T>(name: string, schema2?: Schema2): () => T {
1076
- if (localSchemaNames.has(name) && !isHotReloading() && !isDynamicallyLoading()) {
1077
- debugbreak(2);
1078
- debugger;
1079
- throw new Error(`Already have local schema with name ${JSON.stringify(name)}`);
1080
- }
1081
- if (schema2) {
1082
- registerSchemaPrefix({
1083
- schema: schema2,
1084
- prefixPathStr: getPathStr2(LOCAL_DOMAIN, name),
1085
- });
1086
- }
1087
- localSchemaNames.add(name);
1088
- let schema = rawSchema<{
1089
- [LOCAL_DOMAIN]: {
1090
- [name: string]: T;
1091
- }
1092
- }>();
1093
- // Lazy saves a lot of time on accesses by skipping a few proxy accesses
1094
- return lazy(() => {
1095
- return schema()[LOCAL_DOMAIN][name];
1096
- });
1097
- }
1098
1074
 
1099
1075
  let nextGlobalIndex = 1000 * 1000 * 1000 * 100;
1100
1076
  let nextCallIndex = 1;
@@ -10,8 +10,9 @@ import { blue, green, magenta, yellow } from "socket-function/src/formatting/log
10
10
  import { formatTime } from "socket-function/src/formatting/format";
11
11
  import { measureBlock, measureWrap } from "socket-function/src/profiling/measure";
12
12
  import { debugTime } from "../0-path-value-core/pathValueCore";
13
- import { t } from "./Querysub";
14
13
  import { getProxyPath } from "../2-proxy/pathValueProxy";
14
+ import { createLocalSchema } from "./schemaHelpers";
15
+ import { t } from "../2-proxy/schema2";
15
16
 
16
17
  let commitQueues: Map<string, {
17
18
  callSpec: CallSpec;
@@ -22,7 +23,7 @@ let commitQueues: Map<string, {
22
23
  resolveOrderedPromise: PromiseObj<void>;
23
24
  canBeClobbered: boolean;
24
25
  }[]> = new Map();
25
- let commitQueueCount = Querysub.createLocalSchema("commitQueueCount", {
26
+ let commitQueueCount = createLocalSchema("commitQueueCount", {
26
27
  count: t.number,
27
28
  });
28
29
 
@@ -0,0 +1,36 @@
1
+ import { lazy } from "socket-function/src/caching";
2
+ import { LOCAL_DOMAIN } from "../0-path-value-core/NodePathAuthorities";
3
+ import { registerSchemaPrefix } from "../2-proxy/PathValueProxyWatcher";
4
+ import { rawSchema } from "../2-proxy/pathDatabaseProxyBase";
5
+ import { Schema2, Schema2T } from "../2-proxy/schema2";
6
+ import { isDynamicallyLoading } from "../config";
7
+ import { getPathStr2 } from "../path";
8
+ import { isHotReloading } from "socket-function/hot/HotReloadController";
9
+ import debugbreak from "debugbreak";
10
+
11
+ let localSchemaNames = new Set<string>();
12
+ export function createLocalSchema<T>(name: string): () => T;
13
+ export function createLocalSchema<SchemaDef extends Schema2>(name: string, schema: SchemaDef): () => Schema2T<SchemaDef>;
14
+ export function createLocalSchema<T>(name: string, schema2?: Schema2): () => T {
15
+ if (localSchemaNames.has(name) && !isHotReloading() && !isDynamicallyLoading()) {
16
+ debugbreak(2);
17
+ debugger;
18
+ throw new Error(`Already have local schema with name ${JSON.stringify(name)}`);
19
+ }
20
+ if (schema2) {
21
+ registerSchemaPrefix({
22
+ schema: schema2,
23
+ prefixPathStr: getPathStr2(LOCAL_DOMAIN, name),
24
+ });
25
+ }
26
+ localSchemaNames.add(name);
27
+ let schema = rawSchema<{
28
+ [LOCAL_DOMAIN]: {
29
+ [name: string]: T;
30
+ }
31
+ }>();
32
+ // Lazy saves a lot of time on accesses by skipping a few proxy accesses
33
+ return lazy(() => {
34
+ return schema()[LOCAL_DOMAIN][name];
35
+ });
36
+ }