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 +1 -1
- package/src/4-deploy/edgeNodes.ts +1 -3
- package/src/4-querysub/Querysub.ts +2 -0
- package/src/config.ts +83 -80
package/package.json
CHANGED
|
@@ -110,7 +110,7 @@ export async function registerEdgeNode(config: {
|
|
|
110
110
|
//todonext
|
|
111
111
|
// Testing
|
|
112
112
|
//hash: gitHash,
|
|
113
|
-
hash: "
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
isDynamicallyLoadingCount
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
}
|