@floegence/flowersec-core 0.24.0 → 0.26.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/README.md +6 -0
- package/dist/browser/controlplane.d.ts +1 -1
- package/dist/browser/controlplane.js +0 -1
- package/dist/browser/index.d.ts +3 -3
- package/dist/browser/index.js +2 -2
- package/dist/client-connect/transportSecurity.d.ts +1 -3
- package/dist/client-connect/transportSecurity.js +1 -5
- package/dist/controlplane/request.d.ts +1 -0
- package/dist/controlplane/request.js +77 -2
- package/dist/defaults.d.ts +1 -0
- package/dist/defaults.js +1 -0
- package/dist/endpoint/index.js +185 -33
- package/dist/facade.d.ts +1 -1
- package/dist/facade.js +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.js +1 -1
- package/dist/proxy/appWindow.js +93 -7
- package/dist/proxy/bootstrap.d.ts +5 -24
- package/dist/proxy/bootstrap.js +1 -11
- package/dist/proxy/constants.d.ts +1 -0
- package/dist/proxy/constants.js +1 -0
- package/dist/proxy/controllerWindow.js +219 -78
- package/dist/proxy/integration.js +0 -6
- package/dist/proxy/portStream.d.ts +2 -1
- package/dist/proxy/portStream.js +173 -74
- package/dist/proxy/preset.d.ts +0 -1
- package/dist/proxy/preset.js +0 -9
- package/dist/proxy/runtimeScope.js +2 -7
- package/dist/proxy/server.d.ts +1 -0
- package/dist/proxy/server.js +466 -113
- package/dist/proxy/windowBridgeProtocol.d.ts +4 -3
- package/dist/proxy/windowBridgeProtocol.js +1 -1
- package/package.json +1 -1
- package/dist/proxy/profiles.d.ts +0 -18
- package/dist/proxy/profiles.js +0 -71
|
@@ -3,7 +3,7 @@ export declare const PROXY_WINDOW_FETCH_FORWARD_MSG_TYPE = "flowersec-proxy:wind
|
|
|
3
3
|
export declare const PROXY_WINDOW_FETCH_MSG_TYPE = "flowersec-proxy:fetch";
|
|
4
4
|
export declare const PROXY_WINDOW_WS_OPEN_MSG_TYPE = "flowersec-proxy:ws_open";
|
|
5
5
|
export declare const PROXY_WINDOW_WS_OPEN_ACK_MSG_TYPE = "flowersec-proxy:ws_open_ack";
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const PROXY_WINDOW_WS_BIDIRECTIONAL_ACK_CAPABILITY = "stream_bidirectional_ack_v2";
|
|
7
7
|
export declare const PROXY_WINDOW_WS_ERROR_MSG_TYPE = "flowersec-proxy:ws_error";
|
|
8
8
|
export declare const PROXY_WINDOW_STREAM_CHUNK_MSG_TYPE = "flowersec-proxy:stream_chunk";
|
|
9
9
|
export declare const PROXY_WINDOW_STREAM_WRITE_ACK_MSG_TYPE = "flowersec-proxy:stream_write_ack";
|
|
@@ -32,12 +32,13 @@ export type ProxyWindowWsOpenMsg = Readonly<{
|
|
|
32
32
|
type: typeof PROXY_WINDOW_WS_OPEN_MSG_TYPE;
|
|
33
33
|
path: string;
|
|
34
34
|
protocols?: readonly string[];
|
|
35
|
+
capabilities: readonly string[];
|
|
35
36
|
capabilityNonce?: string;
|
|
36
37
|
}>;
|
|
37
38
|
export type ProxyWindowWsOpenAckMsg = Readonly<{
|
|
38
39
|
type: typeof PROXY_WINDOW_WS_OPEN_ACK_MSG_TYPE;
|
|
39
40
|
protocol: string;
|
|
40
|
-
capabilities
|
|
41
|
+
capabilities: readonly string[];
|
|
41
42
|
}>;
|
|
42
43
|
export type ProxyWindowWsErrorMsg = Readonly<{
|
|
43
44
|
type: typeof PROXY_WINDOW_WS_ERROR_MSG_TYPE;
|
|
@@ -46,7 +47,7 @@ export type ProxyWindowWsErrorMsg = Readonly<{
|
|
|
46
47
|
export type ProxyWindowStreamChunkMsg = Readonly<{
|
|
47
48
|
type: typeof PROXY_WINDOW_STREAM_CHUNK_MSG_TYPE;
|
|
48
49
|
data: ArrayBuffer;
|
|
49
|
-
writeId
|
|
50
|
+
writeId: number;
|
|
50
51
|
}>;
|
|
51
52
|
export type ProxyWindowStreamWriteAckMsg = Readonly<{
|
|
52
53
|
type: typeof PROXY_WINDOW_STREAM_WRITE_ACK_MSG_TYPE;
|
|
@@ -2,7 +2,7 @@ export const PROXY_WINDOW_FETCH_FORWARD_MSG_TYPE = "flowersec-proxy:window_fetch
|
|
|
2
2
|
export const PROXY_WINDOW_FETCH_MSG_TYPE = "flowersec-proxy:fetch";
|
|
3
3
|
export const PROXY_WINDOW_WS_OPEN_MSG_TYPE = "flowersec-proxy:ws_open";
|
|
4
4
|
export const PROXY_WINDOW_WS_OPEN_ACK_MSG_TYPE = "flowersec-proxy:ws_open_ack";
|
|
5
|
-
export const
|
|
5
|
+
export const PROXY_WINDOW_WS_BIDIRECTIONAL_ACK_CAPABILITY = "stream_bidirectional_ack_v2";
|
|
6
6
|
export const PROXY_WINDOW_WS_ERROR_MSG_TYPE = "flowersec-proxy:ws_error";
|
|
7
7
|
export const PROXY_WINDOW_STREAM_CHUNK_MSG_TYPE = "flowersec-proxy:stream_chunk";
|
|
8
8
|
export const PROXY_WINDOW_STREAM_WRITE_ACK_MSG_TYPE = "flowersec-proxy:stream_write_ack";
|
package/package.json
CHANGED
package/dist/proxy/profiles.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { type ProxyPresetManifest } from "./preset.js";
|
|
2
|
-
export type ProxyProfile = Readonly<{
|
|
3
|
-
maxJsonFrameBytes: number;
|
|
4
|
-
maxChunkBytes: number;
|
|
5
|
-
maxBodyBytes: number;
|
|
6
|
-
maxWsFrameBytes: number;
|
|
7
|
-
timeoutMs: number;
|
|
8
|
-
}>;
|
|
9
|
-
export type ProxyProfileName = "default";
|
|
10
|
-
export declare const PROXY_PROFILE_DEFAULT: Readonly<{
|
|
11
|
-
maxJsonFrameBytes: number;
|
|
12
|
-
maxChunkBytes: number;
|
|
13
|
-
maxBodyBytes: number;
|
|
14
|
-
maxWsFrameBytes: number;
|
|
15
|
-
timeoutMs: number;
|
|
16
|
-
}>;
|
|
17
|
-
export declare function resolveProxyProfile(profile?: ProxyProfileName | Partial<ProxyProfile>): ProxyProfile;
|
|
18
|
-
export declare function profileToPresetManifest(profile?: ProxyProfileName | Partial<ProxyProfile>): ProxyPresetManifest;
|
package/dist/proxy/profiles.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_PROXY_PRESET_MANIFEST, resolveProxyPreset, } from "./preset.js";
|
|
2
|
-
function toLegacyProfile(manifest) {
|
|
3
|
-
const resolved = resolveProxyPreset(manifest);
|
|
4
|
-
return Object.freeze({
|
|
5
|
-
maxJsonFrameBytes: resolved.limits.max_json_frame_bytes,
|
|
6
|
-
maxChunkBytes: resolved.limits.max_chunk_bytes,
|
|
7
|
-
maxBodyBytes: resolved.limits.max_body_bytes,
|
|
8
|
-
maxWsFrameBytes: resolved.limits.max_ws_frame_bytes,
|
|
9
|
-
timeoutMs: resolved.limits.timeout_ms ?? 0,
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
const DEFAULT_PROFILE = toLegacyProfile(DEFAULT_PROXY_PRESET_MANIFEST);
|
|
13
|
-
export const PROXY_PROFILE_DEFAULT = DEFAULT_PROFILE;
|
|
14
|
-
function normalizeSafeInt(name, value) {
|
|
15
|
-
if (!Number.isFinite(value))
|
|
16
|
-
throw new Error(`${name} must be a finite number`);
|
|
17
|
-
const n = Math.floor(value);
|
|
18
|
-
if (!Number.isSafeInteger(n))
|
|
19
|
-
throw new Error(`${name} must be a safe integer`);
|
|
20
|
-
if (n < 0)
|
|
21
|
-
throw new Error(`${name} must be >= 0`);
|
|
22
|
-
return n;
|
|
23
|
-
}
|
|
24
|
-
function resolveNamedProfile(name) {
|
|
25
|
-
switch (name) {
|
|
26
|
-
case "default":
|
|
27
|
-
return DEFAULT_PROFILE;
|
|
28
|
-
default:
|
|
29
|
-
throw new Error(`unknown proxy profile: ${name}`);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export function resolveProxyProfile(profile) {
|
|
33
|
-
if (profile == null)
|
|
34
|
-
return DEFAULT_PROFILE;
|
|
35
|
-
if (typeof profile === "string") {
|
|
36
|
-
return resolveNamedProfile(profile);
|
|
37
|
-
}
|
|
38
|
-
const base = DEFAULT_PROFILE;
|
|
39
|
-
return Object.freeze({
|
|
40
|
-
maxJsonFrameBytes: normalizeSafeInt("maxJsonFrameBytes", profile.maxJsonFrameBytes ?? base.maxJsonFrameBytes),
|
|
41
|
-
maxChunkBytes: normalizeSafeInt("maxChunkBytes", profile.maxChunkBytes ?? base.maxChunkBytes),
|
|
42
|
-
maxBodyBytes: normalizeSafeInt("maxBodyBytes", profile.maxBodyBytes ?? base.maxBodyBytes),
|
|
43
|
-
maxWsFrameBytes: normalizeSafeInt("maxWsFrameBytes", profile.maxWsFrameBytes ?? base.maxWsFrameBytes),
|
|
44
|
-
timeoutMs: normalizeSafeInt("timeoutMs", profile.timeoutMs ?? base.timeoutMs),
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
export function profileToPresetManifest(profile) {
|
|
48
|
-
if (profile == null)
|
|
49
|
-
return DEFAULT_PROXY_PRESET_MANIFEST;
|
|
50
|
-
if (typeof profile === "string") {
|
|
51
|
-
switch (profile) {
|
|
52
|
-
case "default":
|
|
53
|
-
return DEFAULT_PROXY_PRESET_MANIFEST;
|
|
54
|
-
default:
|
|
55
|
-
throw new Error(`unknown proxy profile: ${profile}`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
const resolved = resolveProxyProfile(profile);
|
|
59
|
-
return Object.freeze({
|
|
60
|
-
v: 1,
|
|
61
|
-
preset_id: "legacy-profile",
|
|
62
|
-
deprecated: true,
|
|
63
|
-
limits: {
|
|
64
|
-
...(resolved.maxJsonFrameBytes > 0 ? { max_json_frame_bytes: resolved.maxJsonFrameBytes } : {}),
|
|
65
|
-
...(resolved.maxChunkBytes > 0 ? { max_chunk_bytes: resolved.maxChunkBytes } : {}),
|
|
66
|
-
...(resolved.maxBodyBytes > 0 ? { max_body_bytes: resolved.maxBodyBytes } : {}),
|
|
67
|
-
...(resolved.maxWsFrameBytes > 0 ? { max_ws_frame_bytes: resolved.maxWsFrameBytes } : {}),
|
|
68
|
-
...(resolved.timeoutMs > 0 ? { timeout_ms: resolved.timeoutMs } : {}),
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
}
|