querysub 0.120.0 → 0.121.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.120.0",
3
+ "version": "0.121.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",
@@ -110,7 +110,7 @@ export async function registerEdgeNode(config: {
110
110
  //todonext
111
111
  // Testing
112
112
  //hash: gitHash,
113
- hash: "7b1eb4934d5bdfe6d0f7076049c4b7decad4e645",
113
+ hash: "1c222aa091fac592012938172cc1f7d2ee99c7b9",
114
114
  });
115
115
  }
116
116
 
@@ -160,8 +160,6 @@ async function loadEntryPointsByHash(config: {
160
160
  let firstPath = path.resolve(module.filename);
161
161
  let rootPath = firstPath.replaceAll("\\", "/").split("/").slice(0, -depth).join("/") + "/";
162
162
 
163
- debugbreak(2);
164
- debugger;
165
163
  entryPaths = entryPaths.map(x => path.resolve(rootPath + x).replaceAll("\\", "/"));
166
164
 
167
165
  let nodeId = getOwnNodeId();
@@ -771,6 +771,8 @@ function createLocalSchema<T>(name: string): () => T;
771
771
  function createLocalSchema<SchemaDef extends Schema2>(name: string, schema: SchemaDef): () => Schema2T<SchemaDef>;
772
772
  function createLocalSchema<T>(name: string, schema2?: Schema2): () => T {
773
773
  if (localSchemaNames.has(name) && !isHotReloading() && !isDynamicallyLoading()) {
774
+ debugbreak(2);
775
+ debugger;
774
776
  throw new Error(`Already have local schema with name ${JSON.stringify(name)}`);
775
777
  }
776
778
  if (schema2) {
package/src/config.ts CHANGED
@@ -1,81 +1,84 @@
1
- import { isNode, isNodeTrue } from "socket-function/src/misc";
2
- import yargs from "yargs";
3
- import debugbreak from "debugbreak";
4
- import { MaybePromise } from "socket-function/src/types";
5
-
6
- export const serverPort = 11748;
7
-
8
- let yargObj = isNodeTrue() && yargs(process.argv)
9
- .option("nonetwork", { type: "boolean", desc: `Disables all network requirements. Reduces security, as this means we cannot use real certificates.` })
10
- .option("domain", { type: "string", desc: `Sets the domain` })
11
- .option("client", { type: "boolean", desc: `Drops permissions, acting as an unauthenticated node` })
12
- .option("authority", { type: "string", desc: `Defines the base paths we are an authority on (the domain is prepended to them). Either a file path to a JSON(AuthorityPath[]), or a base64 representation of the JSON(AuthorityPath[]).` })
13
- .option("debugbreak", { type: "boolean", desc: "Break and show a popup when there are fatal errors" })
14
- .option("nobreak", { type: "boolean", desc: "Do not break on errors. Safer to set this than to just not set debugbreak, as some places might break without checking debugbreak, but nobreak works at a level where it is always used." })
15
- .option("public", { type: "boolean", desc: "Expose on public ports." })
16
- .option("local", { type: "boolean", desc: `If true, uses the local directory instead of the remote git repo. Also hotreloads from disk. Determines the repo to replace through the package.json "repository" property.` })
17
- .argv || {}
18
- ;
19
-
20
- export function isNoNetwork() {
21
- return yargObj.nonetwork;
22
- }
23
-
24
- export function getDomain() {
25
- if (!isNode()) {
26
- return location.hostname.split(".").slice(-2).join(".");
27
- }
28
- return yargObj.domain || "querysub.com";
29
- }
30
-
31
- export function baseIsClient() {
32
- return !isNode() || yargObj.client;
33
- }
34
-
35
- export function devDebugbreak() {
36
- if (!isNode()) {
37
- debugger;
38
- return;
39
- }
40
- if (!yargObj.debugbreak) return;
41
- debugbreak(2);
42
- debugger;
43
- }
44
- let debuggedEnabled = false;
45
- export function isDevDebugbreak() {
46
- return yargObj.debugbreak || !isNode() && location.hostname.startsWith("noproxy.") || debuggedEnabled;
47
- }
48
- export function enableDebugging() {
49
- debuggedEnabled = true;
50
- }
51
- (globalThis as any).enableDebugging = enableDebugging;
52
-
53
-
54
- export function authorityRaw() {
55
- return yargObj.authority;
56
- }
57
-
58
- export function isPublic() {
59
- if (!isNode()) {
60
- return !location.hostname.startsWith("noproxy.");
61
- }
62
- return !!yargObj.public;
63
- }
64
-
65
- export function isLocal() {
66
- return !!yargObj.local;
67
- }
68
-
69
-
70
- let isDynamicallyLoadingCount = 0;
71
- export function isDynamicallyLoading() {
72
- return isDynamicallyLoadingCount > 0;
73
- }
74
- export async function setIsDynamicallyLoading(code: () => MaybePromise<void>) {
75
- isDynamicallyLoadingCount++;
76
- try {
77
- await code();
78
- } finally {
79
- isDynamicallyLoadingCount--;
80
- }
1
+ import { isNode, isNodeTrue } from "socket-function/src/misc";
2
+ import yargs from "yargs";
3
+ import debugbreak from "debugbreak";
4
+ import { MaybePromise } from "socket-function/src/types";
5
+
6
+ export const serverPort = 11748;
7
+
8
+ let yargObj = isNodeTrue() && yargs(process.argv)
9
+ .option("nonetwork", { type: "boolean", desc: `Disables all network requirements. Reduces security, as this means we cannot use real certificates.` })
10
+ .option("domain", { type: "string", desc: `Sets the domain` })
11
+ .option("client", { type: "boolean", desc: `Drops permissions, acting as an unauthenticated node` })
12
+ .option("authority", { type: "string", desc: `Defines the base paths we are an authority on (the domain is prepended to them). Either a file path to a JSON(AuthorityPath[]), or a base64 representation of the JSON(AuthorityPath[]).` })
13
+ .option("debugbreak", { type: "boolean", desc: "Break and show a popup when there are fatal errors" })
14
+ .option("nobreak", { type: "boolean", desc: "Do not break on errors. Safer to set this than to just not set debugbreak, as some places might break without checking debugbreak, but nobreak works at a level where it is always used." })
15
+ .option("public", { type: "boolean", desc: "Expose on public ports." })
16
+ .option("local", { type: "boolean", desc: `If true, uses the local directory instead of the remote git repo. Also hotreloads from disk. Determines the repo to replace through the package.json "repository" property.` })
17
+ .argv || {}
18
+ ;
19
+
20
+ export function isNoNetwork() {
21
+ return yargObj.nonetwork;
22
+ }
23
+
24
+ export function getDomain() {
25
+ if (!isNode()) {
26
+ return location.hostname.split(".").slice(-2).join(".");
27
+ }
28
+ return yargObj.domain || "querysub.com";
29
+ }
30
+
31
+ export function baseIsClient() {
32
+ return !isNode() || yargObj.client;
33
+ }
34
+
35
+ export function devDebugbreak() {
36
+ if (!isNode()) {
37
+ debugger;
38
+ return;
39
+ }
40
+ if (!yargObj.debugbreak) return;
41
+ debugbreak(2);
42
+ debugger;
43
+ }
44
+ let debuggedEnabled = false;
45
+ export function isDevDebugbreak() {
46
+ return yargObj.debugbreak || !isNode() && location.hostname.startsWith("noproxy.") || debuggedEnabled;
47
+ }
48
+ export function enableDebugging() {
49
+ debuggedEnabled = true;
50
+ }
51
+ (globalThis as any).enableDebugging = enableDebugging;
52
+
53
+
54
+ export function authorityRaw() {
55
+ return yargObj.authority;
56
+ }
57
+
58
+ export function isPublic() {
59
+ if (!isNode()) {
60
+ return !location.hostname.startsWith("noproxy.");
61
+ }
62
+ return !!yargObj.public;
63
+ }
64
+
65
+ export function isLocal() {
66
+ return !!yargObj.local;
67
+ }
68
+
69
+
70
+ declare global {
71
+ var isDynamicallyLoadingCount: number | undefined;
72
+ }
73
+ export function isDynamicallyLoading() {
74
+ globalThis.isDynamicallyLoadingCount = (globalThis.isDynamicallyLoadingCount ?? 0) + 1;
75
+ return globalThis.isDynamicallyLoadingCount > 0;
76
+ }
77
+ export async function setIsDynamicallyLoading(code: () => MaybePromise<void>) {
78
+ globalThis.isDynamicallyLoadingCount = (globalThis.isDynamicallyLoadingCount ?? 0) + 1;
79
+ try {
80
+ await code();
81
+ } finally {
82
+ globalThis.isDynamicallyLoadingCount = (globalThis.isDynamicallyLoadingCount ?? 0) - 1;
83
+ }
81
84
  }