@floegence/floe-webapp-boot 0.36.76 → 0.37.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/dist/index.d.ts +4 -4
- package/dist/index.js +19 -23
- package/dist/index5.js +27 -38
- package/dist/index6.js +17 -47
- package/dist/reconnect.d.ts +2 -6
- package/package.json +2 -2
- package/dist/artifactSource.d.ts +0 -21
- package/dist/index10.js +0 -13
- package/dist/index11.js +0 -50
- package/dist/index12.js +0 -6
- package/dist/index13.js +0 -2
- package/dist/index14.js +0 -1
- package/dist/index15.js +0 -7
- package/dist/index16.js +0 -83
- package/dist/index17.js +0 -195
- package/dist/index18.js +0 -148
- package/dist/index19.js +0 -3
- package/dist/index20.js +0 -6
- package/dist/index21.js +0 -109
- package/dist/index22.js +0 -2
- package/dist/index23.js +0 -1
- package/dist/index24.js +0 -1
- package/dist/index25.js +0 -1
- package/dist/index7.js +0 -32
- package/dist/index8.js +0 -159
- package/dist/index9.js +0 -6
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ export { base64UrlToBase64, clearLocationHash, parseBase64UrlJsonFromHash, parse
|
|
|
2
2
|
export type { WaitForMessageOptions } from './messaging';
|
|
3
3
|
export { postMessageToOrigins, waitForMessage } from './messaging';
|
|
4
4
|
export { getSessionStorage, removeSessionStorage, setSessionStorage } from './storage';
|
|
5
|
-
export type {
|
|
6
|
-
export {
|
|
7
|
-
export type { DirectArtifactReconnectOptions, TunnelArtifactReconnectOptions
|
|
8
|
-
export { createArtifactDirectReconnectConfig, createArtifactTunnelReconnectConfig, createProxyRuntimeTunnelReconnectConfig,
|
|
5
|
+
export type { ArtifactAcquireContext, ArtifactSource } from '@floegence/flowersec-core/reconnect';
|
|
6
|
+
export { createControlplaneArtifactSource } from '@floegence/flowersec-core/reconnect';
|
|
7
|
+
export type { DirectArtifactReconnectOptions, TunnelArtifactReconnectOptions } from './reconnect';
|
|
8
|
+
export { createArtifactDirectReconnectConfig, createArtifactTunnelReconnectConfig, createProxyRuntimeTunnelReconnectConfig, } from './reconnect';
|
|
9
9
|
export type { ScopeEnvelope, ScopeResolver, ScopeResolverMap } from './scope';
|
|
10
10
|
export { createBootstrapScopeResolvers, FLOWERSEC_BOOTSTRAP_SCOPE_RESOLVERS, PROXY_RUNTIME_SCOPE_NAME, validateProxyRuntimeScopeEntry, } from './scope';
|
package/dist/index.js
CHANGED
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
import { base64UrlToBase64 as
|
|
2
|
-
import { postMessageToOrigins as
|
|
3
|
-
import { getSessionStorage as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { FLOWERSEC_BOOTSTRAP_SCOPE_RESOLVERS as
|
|
1
|
+
import { base64UrlToBase64 as r, clearLocationHash as t, parseBase64UrlJsonFromHash as a, parseHashParam as s } from "./index2.js";
|
|
2
|
+
import { postMessageToOrigins as c, waitForMessage as i } from "./index3.js";
|
|
3
|
+
import { getSessionStorage as p, removeSessionStorage as f, setSessionStorage as R } from "./index4.js";
|
|
4
|
+
import { createControlplaneArtifactSource as g } from "@floegence/flowersec-core/reconnect";
|
|
5
|
+
import { createArtifactDirectReconnectConfig as E, createArtifactTunnelReconnectConfig as x, createProxyRuntimeTunnelReconnectConfig as O } from "./index5.js";
|
|
6
|
+
import { FLOWERSEC_BOOTSTRAP_SCOPE_RESOLVERS as P, PROXY_RUNTIME_SCOPE_NAME as T, createBootstrapScopeResolvers as _, validateProxyRuntimeScopeEntry as u } from "./index6.js";
|
|
7
7
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
o as base64UrlToBase64,
|
|
8
|
+
P as FLOWERSEC_BOOTSTRAP_SCOPE_RESOLVERS,
|
|
9
|
+
T as PROXY_RUNTIME_SCOPE_NAME,
|
|
10
|
+
r as base64UrlToBase64,
|
|
12
11
|
t as clearLocationHash,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
x as createFixedArtifactSource,
|
|
20
|
-
F as createProxyRuntimeTunnelReconnectConfig,
|
|
21
|
-
f as getSessionStorage,
|
|
12
|
+
E as createArtifactDirectReconnectConfig,
|
|
13
|
+
x as createArtifactTunnelReconnectConfig,
|
|
14
|
+
_ as createBootstrapScopeResolvers,
|
|
15
|
+
g as createControlplaneArtifactSource,
|
|
16
|
+
O as createProxyRuntimeTunnelReconnectConfig,
|
|
17
|
+
p as getSessionStorage,
|
|
22
18
|
a as parseBase64UrlJsonFromHash,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
s as parseHashParam,
|
|
20
|
+
c as postMessageToOrigins,
|
|
21
|
+
f as removeSessionStorage,
|
|
26
22
|
R as setSessionStorage,
|
|
27
|
-
|
|
23
|
+
u as validateProxyRuntimeScopeEntry,
|
|
28
24
|
i as waitForMessage
|
|
29
25
|
};
|
package/dist/index5.js
CHANGED
|
@@ -1,45 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
function e
|
|
3
|
-
const o = String(t ?? r?.traceId ?? "").trim();
|
|
4
|
-
return o ? { ...r ?? {}, traceId: o } : r;
|
|
5
|
-
}
|
|
6
|
-
function n(r, t = "factory", o) {
|
|
1
|
+
import { createBootstrapScopeResolvers as n } from "./index6.js";
|
|
2
|
+
function r(e) {
|
|
7
3
|
return {
|
|
8
|
-
|
|
9
|
-
...
|
|
10
|
-
|
|
4
|
+
source: e.source,
|
|
5
|
+
...e.observer === void 0 ? {} : { observer: e.observer },
|
|
6
|
+
...e.autoReconnect === void 0 ? {} : { autoReconnect: e.autoReconnect },
|
|
7
|
+
...e.connect === void 0 ? {} : { connect: e.connect }
|
|
11
8
|
};
|
|
12
9
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
...t === void 0 ? {} : { signal: t },
|
|
25
|
-
...e(r.correlation, o) === void 0 ? {} : { correlation: e(r.correlation, o) }
|
|
26
|
-
}),
|
|
27
|
-
"controlplane"
|
|
28
|
-
);
|
|
10
|
+
function t(e) {
|
|
11
|
+
const c = e.connect;
|
|
12
|
+
return r({
|
|
13
|
+
...e,
|
|
14
|
+
connect: {
|
|
15
|
+
...c ?? {},
|
|
16
|
+
scopeResolvers: n(
|
|
17
|
+
c?.scopeResolvers
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
});
|
|
29
21
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"entry_controlplane"
|
|
38
|
-
);
|
|
22
|
+
function u(e) {
|
|
23
|
+
return {
|
|
24
|
+
source: e.source,
|
|
25
|
+
...e.observer === void 0 ? {} : { observer: e.observer },
|
|
26
|
+
...e.autoReconnect === void 0 ? {} : { autoReconnect: e.autoReconnect },
|
|
27
|
+
...e.connect === void 0 ? {} : { connect: e.connect }
|
|
28
|
+
};
|
|
39
29
|
}
|
|
40
30
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
l as createFixedArtifactSource
|
|
31
|
+
u as createArtifactDirectReconnectConfig,
|
|
32
|
+
r as createArtifactTunnelReconnectConfig,
|
|
33
|
+
t as createProxyRuntimeTunnelReconnectConfig
|
|
45
34
|
};
|
package/dist/index6.js
CHANGED
|
@@ -1,52 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
1
|
+
import { assertProxyRuntimeScopeV1 as t } from "@floegence/flowersec-core/proxy";
|
|
2
|
+
const o = "proxy.runtime";
|
|
3
|
+
function r(e) {
|
|
4
|
+
if (e.scope_version !== 1)
|
|
5
|
+
throw new Error(`unsupported ${o} scope_version: ${e.scope_version}`);
|
|
6
|
+
t(e.payload);
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
function
|
|
13
|
-
return e
|
|
14
|
-
}
|
|
15
|
-
function n(e) {
|
|
16
|
-
if (e.artifactSource.kind === "fixed" && a(e.autoReconnect) && e.artifactSource.metadata?.allowAutoReconnect !== !0)
|
|
17
|
-
throw new o();
|
|
18
|
-
}
|
|
19
|
-
function u(e) {
|
|
20
|
-
return n(e), {
|
|
21
|
-
mode: "tunnel",
|
|
22
|
-
getArtifact: t(e.artifactSource),
|
|
23
|
-
...e.observer === void 0 ? {} : { observer: e.observer },
|
|
24
|
-
...e.autoReconnect === void 0 ? {} : { autoReconnect: e.autoReconnect },
|
|
25
|
-
...e.connect === void 0 ? {} : { connect: e.connect }
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function f(e) {
|
|
29
|
-
const c = e.connect;
|
|
30
|
-
return u({
|
|
8
|
+
const n = Object.freeze({
|
|
9
|
+
[o]: r
|
|
10
|
+
});
|
|
11
|
+
function c(e) {
|
|
12
|
+
return e ? Object.freeze({
|
|
31
13
|
...e,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
scopeResolvers: r(c?.scopeResolvers)
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function R(e) {
|
|
39
|
-
return n(e), {
|
|
40
|
-
mode: "direct",
|
|
41
|
-
getArtifact: t(e.artifactSource),
|
|
42
|
-
...e.observer === void 0 ? {} : { observer: e.observer },
|
|
43
|
-
...e.autoReconnect === void 0 ? {} : { autoReconnect: e.autoReconnect },
|
|
44
|
-
...e.connect === void 0 ? {} : { connect: e.connect }
|
|
45
|
-
};
|
|
14
|
+
[o]: r
|
|
15
|
+
}) : n;
|
|
46
16
|
}
|
|
47
17
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
18
|
+
n as FLOWERSEC_BOOTSTRAP_SCOPE_RESOLVERS,
|
|
19
|
+
o as PROXY_RUNTIME_SCOPE_NAME,
|
|
20
|
+
c as createBootstrapScopeResolvers,
|
|
21
|
+
r as validateProxyRuntimeScopeEntry
|
|
52
22
|
};
|
package/dist/reconnect.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { DirectBrowserReconnectConfig, DirectConnectBrowserOptions, TunnelBrowserReconnectConfig, TunnelConnectBrowserOptions } from '@floegence/flowersec-core/browser';
|
|
2
2
|
import type { ClientObserverLike } from '@floegence/flowersec-core/observability';
|
|
3
|
-
import type { AutoReconnectConfig } from '@floegence/flowersec-core/reconnect';
|
|
4
|
-
import type { ArtifactSource } from './artifactSource';
|
|
3
|
+
import type { ArtifactSource, AutoReconnectConfig } from '@floegence/flowersec-core/reconnect';
|
|
5
4
|
type SharedArtifactReconnectOptions = Readonly<{
|
|
6
|
-
|
|
5
|
+
source: ArtifactSource;
|
|
7
6
|
observer?: ClientObserverLike;
|
|
8
7
|
autoReconnect?: AutoReconnectConfig;
|
|
9
8
|
}>;
|
|
@@ -15,9 +14,6 @@ export type TunnelArtifactReconnectOptions = SharedArtifactReconnectOptions & Re
|
|
|
15
14
|
export type DirectArtifactReconnectOptions = SharedArtifactReconnectOptions & Readonly<{
|
|
16
15
|
connect?: DirectArtifactConnectOptions;
|
|
17
16
|
}>;
|
|
18
|
-
export declare class FixedArtifactAutoReconnectError extends Error {
|
|
19
|
-
constructor();
|
|
20
|
-
}
|
|
21
17
|
export declare function createArtifactTunnelReconnectConfig(options: TunnelArtifactReconnectOptions): TunnelBrowserReconnectConfig;
|
|
22
18
|
export declare function createProxyRuntimeTunnelReconnectConfig(options: TunnelArtifactReconnectOptions): TunnelBrowserReconnectConfig;
|
|
23
19
|
export declare function createArtifactDirectReconnectConfig(options: DirectArtifactReconnectOptions): DirectBrowserReconnectConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@floegence/floe-webapp-boot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@floegence/flowersec-core": "^0.
|
|
33
|
+
"@floegence/flowersec-core": "^0.20.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"typescript": "^5.9.3",
|
package/dist/artifactSource.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ConnectArtifact, ConnectArtifactRequestConfig, EntryConnectArtifactRequestConfig } from '@floegence/flowersec-core/browser';
|
|
2
|
-
export type ArtifactRequestContext = Readonly<{
|
|
3
|
-
signal?: AbortSignal;
|
|
4
|
-
traceId?: string;
|
|
5
|
-
}>;
|
|
6
|
-
export type ArtifactSourceKind = 'controlplane' | 'entry_controlplane' | 'fixed' | 'factory';
|
|
7
|
-
export type ArtifactSourceMetadata = Readonly<{
|
|
8
|
-
allowAutoReconnect?: boolean;
|
|
9
|
-
}>;
|
|
10
|
-
export type ArtifactSource = Readonly<{
|
|
11
|
-
kind: ArtifactSourceKind;
|
|
12
|
-
metadata?: ArtifactSourceMetadata;
|
|
13
|
-
getArtifact: (ctx: ArtifactRequestContext) => Promise<ConnectArtifact>;
|
|
14
|
-
}>;
|
|
15
|
-
export type FixedArtifactSourceOptions = Readonly<{
|
|
16
|
-
allowAutoReconnect?: boolean;
|
|
17
|
-
}>;
|
|
18
|
-
export declare function createArtifactSourceFromFactory(getArtifact: (ctx: ArtifactRequestContext) => Promise<ConnectArtifact>, kind?: ArtifactSourceKind, metadata?: ArtifactSourceMetadata): ArtifactSource;
|
|
19
|
-
export declare function createFixedArtifactSource(artifact: ConnectArtifact, options?: FixedArtifactSourceOptions): ArtifactSource;
|
|
20
|
-
export declare function createControlplaneArtifactSource(config: ConnectArtifactRequestConfig): ArtifactSource;
|
|
21
|
-
export declare function createEntryControlplaneArtifactSource(config: EntryConnectArtifactRequestConfig): ArtifactSource;
|
package/dist/index10.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { resolveProxyPreset as m, DEFAULT_PROXY_PRESET_MANIFEST as _, CODESERVER_PROXY_PRESET_MANIFEST as i } from "./index21.js";
|
|
2
|
-
function t(s) {
|
|
3
|
-
const e = m(s);
|
|
4
|
-
return Object.freeze({
|
|
5
|
-
maxJsonFrameBytes: e.limits.max_json_frame_bytes,
|
|
6
|
-
maxChunkBytes: e.limits.max_chunk_bytes,
|
|
7
|
-
maxBodyBytes: e.limits.max_body_bytes,
|
|
8
|
-
maxWsFrameBytes: e.limits.max_ws_frame_bytes,
|
|
9
|
-
timeoutMs: e.limits.timeout_ms ?? 0
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
t(_);
|
|
13
|
-
t(i);
|
package/dist/index11.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
var i;
|
|
2
|
-
(function(e) {
|
|
3
|
-
e[e.Suite_P256_HKDF_SHA256_AES_256_GCM = 2] = "Suite_P256_HKDF_SHA256_AES_256_GCM", e[e.Suite_X25519_HKDF_SHA256_AES_256_GCM = 1] = "Suite_X25519_HKDF_SHA256_AES_256_GCM";
|
|
4
|
-
})(i || (i = {}));
|
|
5
|
-
function o(e) {
|
|
6
|
-
return typeof e == "object" && e != null && !Array.isArray(e);
|
|
7
|
-
}
|
|
8
|
-
function r(e, n) {
|
|
9
|
-
if (typeof n != "string")
|
|
10
|
-
throw new Error(`bad ${e}`);
|
|
11
|
-
return n;
|
|
12
|
-
}
|
|
13
|
-
function _(e, n) {
|
|
14
|
-
if (typeof n != "number" || !Number.isSafeInteger(n))
|
|
15
|
-
throw new Error(`bad ${e}`);
|
|
16
|
-
return n;
|
|
17
|
-
}
|
|
18
|
-
function u(e, n) {
|
|
19
|
-
return _(e, n);
|
|
20
|
-
}
|
|
21
|
-
const c = /* @__PURE__ */ new Set([
|
|
22
|
-
2,
|
|
23
|
-
1
|
|
24
|
-
]);
|
|
25
|
-
function f(e, n) {
|
|
26
|
-
const t = _(e, n);
|
|
27
|
-
if (!c.has(t))
|
|
28
|
-
throw new Error(`bad ${e}`);
|
|
29
|
-
return t;
|
|
30
|
-
}
|
|
31
|
-
function a(e) {
|
|
32
|
-
if (!o(e))
|
|
33
|
-
throw new Error("bad DirectConnectInfo");
|
|
34
|
-
const n = e;
|
|
35
|
-
if (n.ws_url === void 0)
|
|
36
|
-
throw new Error("bad DirectConnectInfo.ws_url");
|
|
37
|
-
if (r("DirectConnectInfo.ws_url", n.ws_url), n.channel_id === void 0)
|
|
38
|
-
throw new Error("bad DirectConnectInfo.channel_id");
|
|
39
|
-
if (r("DirectConnectInfo.channel_id", n.channel_id), n.e2ee_psk_b64u === void 0)
|
|
40
|
-
throw new Error("bad DirectConnectInfo.e2ee_psk_b64u");
|
|
41
|
-
if (r("DirectConnectInfo.e2ee_psk_b64u", n.e2ee_psk_b64u), n.channel_init_expire_at_unix_s === void 0)
|
|
42
|
-
throw new Error("bad DirectConnectInfo.channel_init_expire_at_unix_s");
|
|
43
|
-
if (u("DirectConnectInfo.channel_init_expire_at_unix_s", n.channel_init_expire_at_unix_s), n.default_suite === void 0)
|
|
44
|
-
throw new Error("bad DirectConnectInfo.default_suite");
|
|
45
|
-
return f("DirectConnectInfo.default_suite", n.default_suite), n;
|
|
46
|
-
}
|
|
47
|
-
export {
|
|
48
|
-
i as Suite,
|
|
49
|
-
a as assertDirectConnectInfo
|
|
50
|
-
};
|
package/dist/index12.js
DELETED
package/dist/index13.js
DELETED
package/dist/index14.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
new TextEncoder();
|
package/dist/index15.js
DELETED
package/dist/index16.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
var a;
|
|
2
|
-
(function(e) {
|
|
3
|
-
e[e.Role_client = 1] = "Role_client", e[e.Role_server = 2] = "Role_server";
|
|
4
|
-
})(a || (a = {}));
|
|
5
|
-
var _;
|
|
6
|
-
(function(e) {
|
|
7
|
-
e[e.Suite_P256_HKDF_SHA256_AES_256_GCM = 2] = "Suite_P256_HKDF_SHA256_AES_256_GCM", e[e.Suite_X25519_HKDF_SHA256_AES_256_GCM = 1] = "Suite_X25519_HKDF_SHA256_AES_256_GCM";
|
|
8
|
-
})(_ || (_ = {}));
|
|
9
|
-
function l(e) {
|
|
10
|
-
return typeof e == "object" && e != null && !Array.isArray(e);
|
|
11
|
-
}
|
|
12
|
-
function r(e, n) {
|
|
13
|
-
if (typeof n != "string")
|
|
14
|
-
throw new Error(`bad ${e}`);
|
|
15
|
-
return n;
|
|
16
|
-
}
|
|
17
|
-
function i(e, n) {
|
|
18
|
-
if (typeof n != "number" || !Number.isSafeInteger(n))
|
|
19
|
-
throw new Error(`bad ${e}`);
|
|
20
|
-
return n;
|
|
21
|
-
}
|
|
22
|
-
function u(e, n) {
|
|
23
|
-
const t = i(e, n);
|
|
24
|
-
if (t < -2147483648 || t > 2147483647)
|
|
25
|
-
throw new Error(`bad ${e}`);
|
|
26
|
-
return t;
|
|
27
|
-
}
|
|
28
|
-
function s(e, n) {
|
|
29
|
-
return i(e, n);
|
|
30
|
-
}
|
|
31
|
-
const d = /* @__PURE__ */ new Set([
|
|
32
|
-
1,
|
|
33
|
-
2
|
|
34
|
-
]);
|
|
35
|
-
function h(e, n) {
|
|
36
|
-
const t = i(e, n);
|
|
37
|
-
if (!d.has(t))
|
|
38
|
-
throw new Error(`bad ${e}`);
|
|
39
|
-
return t;
|
|
40
|
-
}
|
|
41
|
-
const f = /* @__PURE__ */ new Set([
|
|
42
|
-
2,
|
|
43
|
-
1
|
|
44
|
-
]);
|
|
45
|
-
function o(e, n) {
|
|
46
|
-
const t = i(e, n);
|
|
47
|
-
if (!f.has(t))
|
|
48
|
-
throw new Error(`bad ${e}`);
|
|
49
|
-
return t;
|
|
50
|
-
}
|
|
51
|
-
function w(e) {
|
|
52
|
-
if (!l(e))
|
|
53
|
-
throw new Error("bad ChannelInitGrant");
|
|
54
|
-
const n = e;
|
|
55
|
-
if (n.tunnel_url === void 0)
|
|
56
|
-
throw new Error("bad ChannelInitGrant.tunnel_url");
|
|
57
|
-
if (r("ChannelInitGrant.tunnel_url", n.tunnel_url), n.channel_id === void 0)
|
|
58
|
-
throw new Error("bad ChannelInitGrant.channel_id");
|
|
59
|
-
if (r("ChannelInitGrant.channel_id", n.channel_id), n.channel_init_expire_at_unix_s === void 0)
|
|
60
|
-
throw new Error("bad ChannelInitGrant.channel_init_expire_at_unix_s");
|
|
61
|
-
if (s("ChannelInitGrant.channel_init_expire_at_unix_s", n.channel_init_expire_at_unix_s), n.idle_timeout_seconds === void 0)
|
|
62
|
-
throw new Error("bad ChannelInitGrant.idle_timeout_seconds");
|
|
63
|
-
if (u("ChannelInitGrant.idle_timeout_seconds", n.idle_timeout_seconds), n.role === void 0)
|
|
64
|
-
throw new Error("bad ChannelInitGrant.role");
|
|
65
|
-
if (h("ChannelInitGrant.role", n.role), n.token === void 0)
|
|
66
|
-
throw new Error("bad ChannelInitGrant.token");
|
|
67
|
-
if (r("ChannelInitGrant.token", n.token), n.e2ee_psk_b64u === void 0)
|
|
68
|
-
throw new Error("bad ChannelInitGrant.e2ee_psk_b64u");
|
|
69
|
-
if (r("ChannelInitGrant.e2ee_psk_b64u", n.e2ee_psk_b64u), n.allowed_suites === void 0)
|
|
70
|
-
throw new Error("bad ChannelInitGrant.allowed_suites");
|
|
71
|
-
if (!Array.isArray(n.allowed_suites))
|
|
72
|
-
throw new Error("bad ChannelInitGrant.allowed_suites");
|
|
73
|
-
for (let t = 0; t < n.allowed_suites.length; t++)
|
|
74
|
-
o("ChannelInitGrant.allowed_suites[]", n.allowed_suites[t]);
|
|
75
|
-
if (n.default_suite === void 0)
|
|
76
|
-
throw new Error("bad ChannelInitGrant.default_suite");
|
|
77
|
-
return o("ChannelInitGrant.default_suite", n.default_suite), n;
|
|
78
|
-
}
|
|
79
|
-
export {
|
|
80
|
-
a as Role,
|
|
81
|
-
_ as Suite,
|
|
82
|
-
w as assertChannelInitGrant
|
|
83
|
-
};
|
package/dist/index17.js
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { assertChannelInitGrant as b, Role as E } from "./index16.js";
|
|
2
|
-
import { assertDirectConnectInfo as C } from "./index11.js";
|
|
3
|
-
const u = /^[a-z][a-z0-9._-]{0,63}$/, h = /^[a-z][a-z0-9._-]{0,31}$/, l = /^[A-Za-z0-9._~-]{8,128}$/, _ = new TextEncoder(), A = /* @__PURE__ */ new Set(["v", "transport", "tunnel_grant", "scoped", "correlation"]), S = /* @__PURE__ */ new Set(["v", "transport", "direct_info", "scoped", "correlation"]);
|
|
4
|
-
function a(r) {
|
|
5
|
-
return typeof r == "object" && r != null && !Array.isArray(r);
|
|
6
|
-
}
|
|
7
|
-
function p(r, t) {
|
|
8
|
-
return Object.prototype.hasOwnProperty.call(r, t);
|
|
9
|
-
}
|
|
10
|
-
function c(r, t, n) {
|
|
11
|
-
for (const e of Object.keys(t))
|
|
12
|
-
if (!n.has(e))
|
|
13
|
-
throw new Error(`bad ${r}.${e}`);
|
|
14
|
-
}
|
|
15
|
-
function g(r, t, n, e) {
|
|
16
|
-
if (typeof t != "number" || !Number.isSafeInteger(t))
|
|
17
|
-
throw new Error(`bad ${r}`);
|
|
18
|
-
if (t < n || t > e)
|
|
19
|
-
throw new Error(`bad ${r}`);
|
|
20
|
-
return t;
|
|
21
|
-
}
|
|
22
|
-
function f(r) {
|
|
23
|
-
return _.encode(r).length;
|
|
24
|
-
}
|
|
25
|
-
function O(r) {
|
|
26
|
-
return m(d(r));
|
|
27
|
-
}
|
|
28
|
-
function d(r) {
|
|
29
|
-
if (r === null)
|
|
30
|
-
return null;
|
|
31
|
-
switch (typeof r) {
|
|
32
|
-
case "string":
|
|
33
|
-
case "boolean":
|
|
34
|
-
return r;
|
|
35
|
-
case "number":
|
|
36
|
-
if (!Number.isFinite(r))
|
|
37
|
-
throw new Error("bad payload.number");
|
|
38
|
-
return r;
|
|
39
|
-
case "object": {
|
|
40
|
-
if (Array.isArray(r))
|
|
41
|
-
return r.map((n) => d(n));
|
|
42
|
-
if (!a(r))
|
|
43
|
-
throw new Error("bad payload.object");
|
|
44
|
-
const t = {};
|
|
45
|
-
for (const n of Object.keys(r).sort())
|
|
46
|
-
t[n] = d(r[n]);
|
|
47
|
-
return t;
|
|
48
|
-
}
|
|
49
|
-
default:
|
|
50
|
-
throw new Error("bad payload.value");
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function m(r) {
|
|
54
|
-
return JSON.stringify(r);
|
|
55
|
-
}
|
|
56
|
-
function w(r) {
|
|
57
|
-
if (Array.isArray(r)) {
|
|
58
|
-
let t = 1;
|
|
59
|
-
for (const n of r)
|
|
60
|
-
t = Math.max(t, 1 + w(n));
|
|
61
|
-
return t;
|
|
62
|
-
}
|
|
63
|
-
if (a(r)) {
|
|
64
|
-
let t = 1;
|
|
65
|
-
for (const n of Object.values(r))
|
|
66
|
-
t = Math.max(t, 1 + w(n));
|
|
67
|
-
return t;
|
|
68
|
-
}
|
|
69
|
-
return 0;
|
|
70
|
-
}
|
|
71
|
-
function y(r) {
|
|
72
|
-
if (typeof r != "string")
|
|
73
|
-
return;
|
|
74
|
-
const t = r.trim();
|
|
75
|
-
if (l.test(t))
|
|
76
|
-
return t;
|
|
77
|
-
}
|
|
78
|
-
function z(r) {
|
|
79
|
-
if (!a(r))
|
|
80
|
-
throw new Error("bad CorrelationKV");
|
|
81
|
-
if (c("CorrelationKV", r, /* @__PURE__ */ new Set(["key", "value"])), typeof r.key != "string" || !h.test(r.key))
|
|
82
|
-
throw new Error("bad CorrelationKV.key");
|
|
83
|
-
if (typeof r.value != "string")
|
|
84
|
-
throw new Error("bad CorrelationKV.value");
|
|
85
|
-
if (f(r.key) > 32)
|
|
86
|
-
throw new Error("bad CorrelationKV.key");
|
|
87
|
-
if (f(r.value) > 128)
|
|
88
|
-
throw new Error("bad CorrelationKV.value");
|
|
89
|
-
return Object.freeze({ key: r.key, value: r.value });
|
|
90
|
-
}
|
|
91
|
-
function j(r) {
|
|
92
|
-
if (!a(r))
|
|
93
|
-
throw new Error("bad CorrelationContext");
|
|
94
|
-
if (c("CorrelationContext", r, /* @__PURE__ */ new Set(["v", "trace_id", "session_id", "tags"])), r.v !== 1)
|
|
95
|
-
throw new Error("bad CorrelationContext.v");
|
|
96
|
-
const t = r.tags;
|
|
97
|
-
if (t !== void 0 && !Array.isArray(t))
|
|
98
|
-
throw new Error("bad CorrelationContext.tags");
|
|
99
|
-
const n = (t ?? []).map((i) => z(i)), e = /* @__PURE__ */ new Set();
|
|
100
|
-
for (const i of n) {
|
|
101
|
-
if (e.has(i.key))
|
|
102
|
-
throw new Error("bad CorrelationContext.tags");
|
|
103
|
-
e.add(i.key);
|
|
104
|
-
}
|
|
105
|
-
if (n.length > 8)
|
|
106
|
-
throw new Error("bad CorrelationContext.tags");
|
|
107
|
-
const o = y(r.trace_id), s = y(r.session_id);
|
|
108
|
-
return Object.freeze({
|
|
109
|
-
v: 1,
|
|
110
|
-
...o === void 0 ? {} : { trace_id: o },
|
|
111
|
-
...s === void 0 ? {} : { session_id: s },
|
|
112
|
-
tags: Object.freeze(n)
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
function k(r) {
|
|
116
|
-
if (!a(r))
|
|
117
|
-
throw new Error("bad ScopeMetadataEntry.payload");
|
|
118
|
-
const t = O(r);
|
|
119
|
-
if (f(t) > 8192)
|
|
120
|
-
throw new Error("bad ScopeMetadataEntry.payload");
|
|
121
|
-
if (w(r) > 8)
|
|
122
|
-
throw new Error("bad ScopeMetadataEntry.payload");
|
|
123
|
-
return r;
|
|
124
|
-
}
|
|
125
|
-
function T(r) {
|
|
126
|
-
if (!a(r))
|
|
127
|
-
throw new Error("bad ScopeMetadataEntry");
|
|
128
|
-
if (c("ScopeMetadataEntry", r, /* @__PURE__ */ new Set(["scope", "scope_version", "critical", "payload"])), typeof r.scope != "string" || !u.test(r.scope))
|
|
129
|
-
throw new Error("bad ScopeMetadataEntry.scope");
|
|
130
|
-
if (typeof r.critical != "boolean")
|
|
131
|
-
throw new Error("bad ScopeMetadataEntry.critical");
|
|
132
|
-
const t = g("ScopeMetadataEntry.scope_version", r.scope_version, 1, 65535), n = k(r.payload);
|
|
133
|
-
return Object.freeze({
|
|
134
|
-
scope: r.scope,
|
|
135
|
-
scope_version: t,
|
|
136
|
-
critical: r.critical,
|
|
137
|
-
payload: n
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
function I(r) {
|
|
141
|
-
if (!Array.isArray(r))
|
|
142
|
-
throw new Error("bad ConnectArtifact.scoped");
|
|
143
|
-
if (r.length > 8)
|
|
144
|
-
throw new Error("bad ConnectArtifact.scoped");
|
|
145
|
-
const t = r.map((e) => T(e)), n = /* @__PURE__ */ new Set();
|
|
146
|
-
for (const e of t) {
|
|
147
|
-
if (n.has(e.scope))
|
|
148
|
-
throw new Error("bad ConnectArtifact.scoped");
|
|
149
|
-
n.add(e.scope);
|
|
150
|
-
}
|
|
151
|
-
return Object.freeze(t);
|
|
152
|
-
}
|
|
153
|
-
function x(r) {
|
|
154
|
-
if (!a(r))
|
|
155
|
-
throw new Error("bad ConnectArtifact");
|
|
156
|
-
return r;
|
|
157
|
-
}
|
|
158
|
-
function M(r) {
|
|
159
|
-
if (r !== "tunnel" && r !== "direct")
|
|
160
|
-
throw new Error("bad ConnectArtifact.transport");
|
|
161
|
-
return r;
|
|
162
|
-
}
|
|
163
|
-
function K(r) {
|
|
164
|
-
const t = x(r);
|
|
165
|
-
if (t.v !== 1)
|
|
166
|
-
throw new Error("bad ConnectArtifact.v");
|
|
167
|
-
const n = M(t.transport), e = t.scoped === void 0 ? void 0 : I(t.scoped), o = t.correlation === void 0 ? void 0 : j(t.correlation);
|
|
168
|
-
if (n === "tunnel") {
|
|
169
|
-
if (c("TunnelClientConnectArtifact", t, A), !p(t, "tunnel_grant"))
|
|
170
|
-
throw new Error("bad TunnelClientConnectArtifact.tunnel_grant");
|
|
171
|
-
const i = b(t.tunnel_grant);
|
|
172
|
-
if (i.role !== E.Role_client)
|
|
173
|
-
throw new Error("bad TunnelClientConnectArtifact.tunnel_grant.role");
|
|
174
|
-
return Object.freeze({
|
|
175
|
-
v: 1,
|
|
176
|
-
transport: n,
|
|
177
|
-
tunnel_grant: i,
|
|
178
|
-
...e === void 0 ? {} : { scoped: e },
|
|
179
|
-
...o === void 0 ? {} : { correlation: o }
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
if (c("DirectClientConnectArtifact", t, S), !p(t, "direct_info"))
|
|
183
|
-
throw new Error("bad DirectClientConnectArtifact.direct_info");
|
|
184
|
-
const s = C(t.direct_info);
|
|
185
|
-
return Object.freeze({
|
|
186
|
-
v: 1,
|
|
187
|
-
transport: n,
|
|
188
|
-
direct_info: s,
|
|
189
|
-
...e === void 0 ? {} : { scoped: e },
|
|
190
|
-
...o === void 0 ? {} : { correlation: o }
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
export {
|
|
194
|
-
K as assertConnectArtifact
|
|
195
|
-
};
|
package/dist/index18.js
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { assertProxyPresetManifest as u } from "./index21.js";
|
|
2
|
-
const x = /^[a-z][a-z0-9._-]{0,63}$/, w = 8 * 1024, h = 8, B = 64, b = 4 * 1024;
|
|
3
|
-
function i(r) {
|
|
4
|
-
return typeof r == "object" && r != null && !Array.isArray(r);
|
|
5
|
-
}
|
|
6
|
-
function d(r, e, t) {
|
|
7
|
-
const o = new Set(t);
|
|
8
|
-
for (const n of Object.keys(e))
|
|
9
|
-
if (!o.has(n))
|
|
10
|
-
throw new Error(`bad ${r}.${n}`);
|
|
11
|
-
}
|
|
12
|
-
function s(r, e) {
|
|
13
|
-
if (typeof e != "number" || !Number.isSafeInteger(e) || e <= 0)
|
|
14
|
-
throw new Error(`bad ${r}`);
|
|
15
|
-
return e;
|
|
16
|
-
}
|
|
17
|
-
function a(r) {
|
|
18
|
-
return new TextEncoder().encode(r).length;
|
|
19
|
-
}
|
|
20
|
-
function c(r) {
|
|
21
|
-
if (Array.isArray(r)) {
|
|
22
|
-
let e = 1;
|
|
23
|
-
for (const t of r)
|
|
24
|
-
e = Math.max(e, 1 + c(t));
|
|
25
|
-
return e;
|
|
26
|
-
}
|
|
27
|
-
if (i(r)) {
|
|
28
|
-
let e = 1;
|
|
29
|
-
for (const t of Object.values(r))
|
|
30
|
-
e = Math.max(e, 1 + c(t));
|
|
31
|
-
return e;
|
|
32
|
-
}
|
|
33
|
-
return 0;
|
|
34
|
-
}
|
|
35
|
-
function f(r) {
|
|
36
|
-
return Array.isArray(r) ? r.reduce((e, t) => e + f(t), 0) : i(r) ? Object.entries(r).reduce((e, [, t]) => e + 1 + f(t), 0) : 0;
|
|
37
|
-
}
|
|
38
|
-
function E(r) {
|
|
39
|
-
if (!i(r))
|
|
40
|
-
throw new Error("bad proxy.runtime.payload");
|
|
41
|
-
if (a(JSON.stringify(r)) > w)
|
|
42
|
-
throw new Error("bad proxy.runtime.payload");
|
|
43
|
-
if (c(r) > h)
|
|
44
|
-
throw new Error("bad proxy.runtime.payload");
|
|
45
|
-
if (f(r) > B)
|
|
46
|
-
throw new Error("bad proxy.runtime.payload");
|
|
47
|
-
return r;
|
|
48
|
-
}
|
|
49
|
-
function l(r) {
|
|
50
|
-
if (!i(r))
|
|
51
|
-
throw new Error("bad proxy.runtime.serviceWorker");
|
|
52
|
-
d("proxy.runtime.serviceWorker", r, ["scriptUrl", "scope"]);
|
|
53
|
-
const e = String(r.scriptUrl ?? "").trim(), t = String(r.scope ?? "").trim();
|
|
54
|
-
if (e === "")
|
|
55
|
-
throw new Error("bad proxy.runtime.serviceWorker.scriptUrl");
|
|
56
|
-
if (t === "")
|
|
57
|
-
throw new Error("bad proxy.runtime.serviceWorker.scope");
|
|
58
|
-
return Object.freeze({ scriptUrl: e, scope: t });
|
|
59
|
-
}
|
|
60
|
-
function g(r) {
|
|
61
|
-
if (!Array.isArray(r))
|
|
62
|
-
throw new Error("bad proxy.runtime.controllerBridge.allowedOrigins");
|
|
63
|
-
const e = [], t = /* @__PURE__ */ new Set();
|
|
64
|
-
for (const o of r) {
|
|
65
|
-
const n = String(o ?? "").trim();
|
|
66
|
-
n === "" || t.has(n) || (t.add(n), e.push(n));
|
|
67
|
-
}
|
|
68
|
-
if (e.length === 0)
|
|
69
|
-
throw new Error("bad proxy.runtime.controllerBridge.allowedOrigins");
|
|
70
|
-
return Object.freeze(e);
|
|
71
|
-
}
|
|
72
|
-
function O(r) {
|
|
73
|
-
if (!i(r))
|
|
74
|
-
throw new Error("bad proxy.runtime.controllerBridge");
|
|
75
|
-
return d("proxy.runtime.controllerBridge", r, ["allowedOrigins"]), Object.freeze({
|
|
76
|
-
allowedOrigins: g(r.allowedOrigins)
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
function k(r) {
|
|
80
|
-
if (!i(r))
|
|
81
|
-
throw new Error("bad proxy.runtime.limits");
|
|
82
|
-
d("proxy.runtime.limits", r, [
|
|
83
|
-
"timeoutMs",
|
|
84
|
-
"maxJsonFrameBytes",
|
|
85
|
-
"maxChunkBytes",
|
|
86
|
-
"maxBodyBytes",
|
|
87
|
-
"maxWsFrameBytes"
|
|
88
|
-
]);
|
|
89
|
-
const e = {};
|
|
90
|
-
return r.timeoutMs !== void 0 && (e.timeoutMs = s("proxy.runtime.limits.timeoutMs", r.timeoutMs)), r.maxJsonFrameBytes !== void 0 && (e.maxJsonFrameBytes = s("proxy.runtime.limits.maxJsonFrameBytes", r.maxJsonFrameBytes)), r.maxChunkBytes !== void 0 && (e.maxChunkBytes = s("proxy.runtime.limits.maxChunkBytes", r.maxChunkBytes)), r.maxBodyBytes !== void 0 && (e.maxBodyBytes = s("proxy.runtime.limits.maxBodyBytes", r.maxBodyBytes)), r.maxWsFrameBytes !== void 0 && (e.maxWsFrameBytes = s("proxy.runtime.limits.maxWsFrameBytes", r.maxWsFrameBytes)), Object.freeze(e);
|
|
91
|
-
}
|
|
92
|
-
function S(r) {
|
|
93
|
-
if (!i(r))
|
|
94
|
-
throw new Error("bad proxy.runtime.preset");
|
|
95
|
-
d("proxy.runtime.preset", r, ["presetId", "snapshot"]);
|
|
96
|
-
const e = String(r.presetId ?? "").trim();
|
|
97
|
-
if (!x.test(e))
|
|
98
|
-
throw new Error("bad proxy.runtime.preset.presetId");
|
|
99
|
-
if (r.snapshot === void 0)
|
|
100
|
-
return Object.freeze({ presetId: e });
|
|
101
|
-
const t = u(r.snapshot);
|
|
102
|
-
if (a(JSON.stringify(t)) > b)
|
|
103
|
-
throw new Error("bad proxy.runtime.preset.snapshot");
|
|
104
|
-
return Object.freeze({ presetId: e, snapshot: t });
|
|
105
|
-
}
|
|
106
|
-
function M(r) {
|
|
107
|
-
const e = E(r);
|
|
108
|
-
d("proxy.runtime", e, [
|
|
109
|
-
"mode",
|
|
110
|
-
"appBasePath",
|
|
111
|
-
"serviceWorker",
|
|
112
|
-
"controllerBridge",
|
|
113
|
-
"preset",
|
|
114
|
-
"limits"
|
|
115
|
-
]);
|
|
116
|
-
const t = e.mode;
|
|
117
|
-
if (t !== "service_worker" && t !== "controller_bridge")
|
|
118
|
-
throw new Error("bad proxy.runtime.mode");
|
|
119
|
-
const o = e.appBasePath === void 0 ? void 0 : String(e.appBasePath ?? "").trim();
|
|
120
|
-
if (e.appBasePath !== void 0 && o === "")
|
|
121
|
-
throw new Error("bad proxy.runtime.appBasePath");
|
|
122
|
-
const n = S(e.preset), m = e.limits === void 0 ? void 0 : k(e.limits);
|
|
123
|
-
if (t === "service_worker") {
|
|
124
|
-
if (e.controllerBridge !== void 0)
|
|
125
|
-
throw new Error("bad proxy.runtime.controllerBridge");
|
|
126
|
-
const p = l(e.serviceWorker);
|
|
127
|
-
return Object.freeze({
|
|
128
|
-
mode: t,
|
|
129
|
-
...o === void 0 ? {} : { appBasePath: o },
|
|
130
|
-
serviceWorker: p,
|
|
131
|
-
preset: n,
|
|
132
|
-
...m === void 0 ? {} : { limits: m }
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
if (e.serviceWorker !== void 0)
|
|
136
|
-
throw new Error("bad proxy.runtime.serviceWorker");
|
|
137
|
-
const y = O(e.controllerBridge);
|
|
138
|
-
return Object.freeze({
|
|
139
|
-
mode: t,
|
|
140
|
-
...o === void 0 ? {} : { appBasePath: o },
|
|
141
|
-
controllerBridge: y,
|
|
142
|
-
preset: n,
|
|
143
|
-
...m === void 0 ? {} : { limits: m }
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
export {
|
|
147
|
-
M as assertProxyRuntimeScopeV1
|
|
148
|
-
};
|
package/dist/index19.js
DELETED
package/dist/index20.js
DELETED
package/dist/index21.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_MAX_JSON_FRAME_BYTES as r } from "./index9.js";
|
|
2
|
-
import { DEFAULT_MAX_WS_FRAME_BYTES as b, DEFAULT_MAX_BODY_BYTES as m, DEFAULT_MAX_CHUNK_BYTES as o } from "./index20.js";
|
|
3
|
-
const c = /^[a-z][a-z0-9._-]{0,63}$/, _ = Object.freeze({
|
|
4
|
-
max_json_frame_bytes: r,
|
|
5
|
-
max_chunk_bytes: o,
|
|
6
|
-
max_body_bytes: m,
|
|
7
|
-
max_ws_frame_bytes: b
|
|
8
|
-
}), w = Object.freeze({
|
|
9
|
-
v: 1,
|
|
10
|
-
preset_id: "default",
|
|
11
|
-
limits: {
|
|
12
|
-
max_json_frame_bytes: r,
|
|
13
|
-
max_chunk_bytes: o,
|
|
14
|
-
max_body_bytes: m,
|
|
15
|
-
max_ws_frame_bytes: b
|
|
16
|
-
}
|
|
17
|
-
}), p = Object.freeze({
|
|
18
|
-
v: 1,
|
|
19
|
-
preset_id: "codeserver",
|
|
20
|
-
deprecated: !0,
|
|
21
|
-
limits: {
|
|
22
|
-
max_json_frame_bytes: r,
|
|
23
|
-
max_chunk_bytes: o,
|
|
24
|
-
max_body_bytes: m,
|
|
25
|
-
max_ws_frame_bytes: 32 * 1024 * 1024
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
function i(e) {
|
|
29
|
-
return typeof e == "object" && e != null && !Array.isArray(e);
|
|
30
|
-
}
|
|
31
|
-
function y(e, t, d) {
|
|
32
|
-
const x = new Set(d);
|
|
33
|
-
for (const a of Object.keys(t))
|
|
34
|
-
if (!x.has(a))
|
|
35
|
-
throw new Error(`bad ${e}.${a}`);
|
|
36
|
-
}
|
|
37
|
-
function s(e, t) {
|
|
38
|
-
if (typeof t != "number" || !Number.isSafeInteger(t) || t <= 0)
|
|
39
|
-
throw new Error(`${e} must be a positive safe integer`);
|
|
40
|
-
return t;
|
|
41
|
-
}
|
|
42
|
-
function f(e) {
|
|
43
|
-
if (!i(e))
|
|
44
|
-
throw new Error("bad ProxyPresetManifest.limits");
|
|
45
|
-
y("ProxyPresetManifest.limits", e, [
|
|
46
|
-
"max_json_frame_bytes",
|
|
47
|
-
"max_chunk_bytes",
|
|
48
|
-
"max_body_bytes",
|
|
49
|
-
"max_ws_frame_bytes",
|
|
50
|
-
"timeout_ms"
|
|
51
|
-
]);
|
|
52
|
-
const t = {};
|
|
53
|
-
return e.max_json_frame_bytes !== void 0 && (t.max_json_frame_bytes = s("max_json_frame_bytes", e.max_json_frame_bytes)), e.max_chunk_bytes !== void 0 && (t.max_chunk_bytes = s("max_chunk_bytes", e.max_chunk_bytes)), e.max_body_bytes !== void 0 && (t.max_body_bytes = s("max_body_bytes", e.max_body_bytes)), e.max_ws_frame_bytes !== void 0 && (t.max_ws_frame_bytes = s("max_ws_frame_bytes", e.max_ws_frame_bytes)), e.timeout_ms !== void 0 && (t.timeout_ms = s("timeout_ms", e.timeout_ms)), Object.freeze(t);
|
|
54
|
-
}
|
|
55
|
-
function E(e) {
|
|
56
|
-
if (!i(e))
|
|
57
|
-
throw new Error("bad ProxyPresetManifest");
|
|
58
|
-
if (y("ProxyPresetManifest", e, ["v", "preset_id", "deprecated", "limits"]), e.v !== 1)
|
|
59
|
-
throw new Error("bad ProxyPresetManifest.v");
|
|
60
|
-
if (typeof e.preset_id != "string" || !c.test(e.preset_id))
|
|
61
|
-
throw new Error("bad ProxyPresetManifest.preset_id");
|
|
62
|
-
if (e.deprecated !== void 0 && typeof e.deprecated != "boolean")
|
|
63
|
-
throw new Error("bad ProxyPresetManifest.deprecated");
|
|
64
|
-
return Object.freeze({
|
|
65
|
-
v: 1,
|
|
66
|
-
preset_id: e.preset_id,
|
|
67
|
-
...e.deprecated === void 0 ? {} : { deprecated: e.deprecated },
|
|
68
|
-
limits: f(e.limits)
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
function n(e) {
|
|
72
|
-
return Object.freeze({
|
|
73
|
-
v: 1,
|
|
74
|
-
preset_id: e.preset_id,
|
|
75
|
-
deprecated: e.deprecated === !0,
|
|
76
|
-
limits: Object.freeze({
|
|
77
|
-
max_json_frame_bytes: e.limits.max_json_frame_bytes ?? _.max_json_frame_bytes,
|
|
78
|
-
max_chunk_bytes: e.limits.max_chunk_bytes ?? _.max_chunk_bytes,
|
|
79
|
-
max_body_bytes: e.limits.max_body_bytes ?? _.max_body_bytes,
|
|
80
|
-
max_ws_frame_bytes: e.limits.max_ws_frame_bytes ?? _.max_ws_frame_bytes,
|
|
81
|
-
...e.limits.timeout_ms === void 0 ? {} : { timeout_ms: e.limits.timeout_ms }
|
|
82
|
-
})
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function P(e) {
|
|
86
|
-
if (e == null)
|
|
87
|
-
return n(w);
|
|
88
|
-
if (i(e) && ("v" in e || "presetId" in e || "limits" in e))
|
|
89
|
-
return n(E(e));
|
|
90
|
-
const t = f(e);
|
|
91
|
-
return Object.freeze({
|
|
92
|
-
v: 1,
|
|
93
|
-
preset_id: "custom",
|
|
94
|
-
deprecated: !1,
|
|
95
|
-
limits: Object.freeze({
|
|
96
|
-
max_json_frame_bytes: t.max_json_frame_bytes ?? _.max_json_frame_bytes,
|
|
97
|
-
max_chunk_bytes: t.max_chunk_bytes ?? _.max_chunk_bytes,
|
|
98
|
-
max_body_bytes: t.max_body_bytes ?? _.max_body_bytes,
|
|
99
|
-
max_ws_frame_bytes: t.max_ws_frame_bytes ?? _.max_ws_frame_bytes,
|
|
100
|
-
...t.timeout_ms === void 0 ? {} : { timeout_ms: t.timeout_ms }
|
|
101
|
-
})
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
export {
|
|
105
|
-
p as CODESERVER_PROXY_PRESET_MANIFEST,
|
|
106
|
-
w as DEFAULT_PROXY_PRESET_MANIFEST,
|
|
107
|
-
E as assertProxyPresetManifest,
|
|
108
|
-
P as resolveProxyPreset
|
|
109
|
-
};
|
package/dist/index22.js
DELETED
package/dist/index23.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
new TextEncoder();
|
package/dist/index24.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
new TextEncoder();
|
package/dist/index25.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
new TextEncoder();
|
package/dist/index7.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import "./index9.js";
|
|
2
|
-
import "./index10.js";
|
|
3
|
-
import "./index11.js";
|
|
4
|
-
import "./index12.js";
|
|
5
|
-
import "./index13.js";
|
|
6
|
-
import "./index14.js";
|
|
7
|
-
import "./index15.js";
|
|
8
|
-
import "./index16.js";
|
|
9
|
-
import "./index17.js";
|
|
10
|
-
import { assertProxyRuntimeScopeV1 as t } from "./index18.js";
|
|
11
|
-
import "./index19.js";
|
|
12
|
-
const r = "proxy.runtime";
|
|
13
|
-
function e(o) {
|
|
14
|
-
if (o.scope_version !== 1)
|
|
15
|
-
throw new Error(`unsupported ${r} scope_version: ${o.scope_version}`);
|
|
16
|
-
t(o.payload);
|
|
17
|
-
}
|
|
18
|
-
const p = Object.freeze({
|
|
19
|
-
[r]: e
|
|
20
|
-
});
|
|
21
|
-
function f(o) {
|
|
22
|
-
return o ? Object.freeze({
|
|
23
|
-
...o,
|
|
24
|
-
[r]: e
|
|
25
|
-
}) : p;
|
|
26
|
-
}
|
|
27
|
-
export {
|
|
28
|
-
p as FLOWERSEC_BOOTSTRAP_SCOPE_RESOLVERS,
|
|
29
|
-
r as PROXY_RUNTIME_SCOPE_NAME,
|
|
30
|
-
f as createBootstrapScopeResolvers,
|
|
31
|
-
e as validateProxyRuntimeScopeEntry
|
|
32
|
-
};
|
package/dist/index8.js
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { assertConnectArtifact as l } from "./index17.js";
|
|
2
|
-
class d extends Error {
|
|
3
|
-
status;
|
|
4
|
-
code;
|
|
5
|
-
responseBody;
|
|
6
|
-
constructor(e) {
|
|
7
|
-
super(e.message), this.name = "ControlplaneRequestError", this.status = e.status, this.code = String(e.code ?? "").trim(), this.responseBody = e.responseBody;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
const w = "/v1/connect/artifact", y = "/v1/connect/artifact/entry", T = 1 << 20;
|
|
11
|
-
class c extends Error {
|
|
12
|
-
constructor(e) {
|
|
13
|
-
super(`controlplane response exceeded ${e} bytes`), this.name = "ControlplaneResponseTooLargeError";
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function m(t) {
|
|
17
|
-
if (t)
|
|
18
|
-
return t;
|
|
19
|
-
if (typeof globalThis.fetch == "function")
|
|
20
|
-
return globalThis.fetch.bind(globalThis);
|
|
21
|
-
throw new Error("global fetch is not available");
|
|
22
|
-
}
|
|
23
|
-
function u(t, e) {
|
|
24
|
-
const r = String(t ?? "").trim();
|
|
25
|
-
return r === "" ? e : `${r.replace(/\/+$/, "")}${e}`;
|
|
26
|
-
}
|
|
27
|
-
function b(t) {
|
|
28
|
-
const e = String(t ?? "").trim();
|
|
29
|
-
if (e === "")
|
|
30
|
-
return "";
|
|
31
|
-
try {
|
|
32
|
-
return JSON.parse(e);
|
|
33
|
-
} catch {
|
|
34
|
-
return e;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function E(t) {
|
|
38
|
-
const e = String(t ?? "").trim();
|
|
39
|
-
if (e === "" || !/^[0-9]+$/.test(e))
|
|
40
|
-
return null;
|
|
41
|
-
const r = Number(e);
|
|
42
|
-
return !Number.isSafeInteger(r) || r < 0 ? null : r;
|
|
43
|
-
}
|
|
44
|
-
async function S(t, e) {
|
|
45
|
-
const r = E(t.headers.get("Content-Length"));
|
|
46
|
-
if (r !== null && r > e)
|
|
47
|
-
throw new c(e);
|
|
48
|
-
if (!t.body)
|
|
49
|
-
return "";
|
|
50
|
-
const n = t.body.getReader(), a = new TextDecoder();
|
|
51
|
-
let o = 0, s = "";
|
|
52
|
-
for (; ; ) {
|
|
53
|
-
const i = await n.read();
|
|
54
|
-
if (i.done)
|
|
55
|
-
break;
|
|
56
|
-
if (o += i.value.byteLength, o > e) {
|
|
57
|
-
try {
|
|
58
|
-
await n.cancel();
|
|
59
|
-
} catch {
|
|
60
|
-
}
|
|
61
|
-
throw new c(e);
|
|
62
|
-
}
|
|
63
|
-
s += a.decode(i.value, { stream: !0 });
|
|
64
|
-
}
|
|
65
|
-
return s += a.decode(), s;
|
|
66
|
-
}
|
|
67
|
-
function C(t, e) {
|
|
68
|
-
let r = `controlplane request failed: ${t}`, n = "";
|
|
69
|
-
if (e && typeof e == "object") {
|
|
70
|
-
const a = e.error;
|
|
71
|
-
if (a && typeof a == "object") {
|
|
72
|
-
const o = String(a.message ?? "").trim();
|
|
73
|
-
o !== "" && (r = o), n = String(a.code ?? "").trim();
|
|
74
|
-
}
|
|
75
|
-
} else typeof e == "string" && e !== "" && (r = e);
|
|
76
|
-
return { code: n, message: r };
|
|
77
|
-
}
|
|
78
|
-
async function f(t, e) {
|
|
79
|
-
const n = await m(e.fetch)(t, {
|
|
80
|
-
...e,
|
|
81
|
-
cache: "no-store"
|
|
82
|
-
});
|
|
83
|
-
let a = "";
|
|
84
|
-
try {
|
|
85
|
-
a = await S(n, T);
|
|
86
|
-
} catch (s) {
|
|
87
|
-
throw s instanceof c && !n.ok ? new d({
|
|
88
|
-
status: n.status,
|
|
89
|
-
message: s.message
|
|
90
|
-
}) : s;
|
|
91
|
-
}
|
|
92
|
-
const o = b(a);
|
|
93
|
-
if (!n.ok) {
|
|
94
|
-
const s = C(n.status, o);
|
|
95
|
-
throw new d({
|
|
96
|
-
status: n.status,
|
|
97
|
-
message: s.message,
|
|
98
|
-
code: s.code,
|
|
99
|
-
responseBody: o
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
if (typeof o == "string")
|
|
103
|
-
throw o === "" ? new Error("Invalid controlplane response: expected JSON body") : new Error("Invalid controlplane response: expected JSON body");
|
|
104
|
-
return o;
|
|
105
|
-
}
|
|
106
|
-
function h(t) {
|
|
107
|
-
const e = {
|
|
108
|
-
endpoint_id: String(t.endpointId ?? "").trim()
|
|
109
|
-
};
|
|
110
|
-
if (e.endpoint_id === "")
|
|
111
|
-
throw new Error("endpointId is required");
|
|
112
|
-
t.payload !== void 0 && (e.payload = { ...t.payload });
|
|
113
|
-
const r = String(t.correlation?.traceId ?? "").trim();
|
|
114
|
-
return r !== "" && (e.correlation = { trace_id: r }), e;
|
|
115
|
-
}
|
|
116
|
-
function p(t) {
|
|
117
|
-
const e = new Headers(t);
|
|
118
|
-
return e.has("Content-Type") || e.set("Content-Type", "application/json"), e;
|
|
119
|
-
}
|
|
120
|
-
async function _(t) {
|
|
121
|
-
const e = await f(u(t.baseUrl, t.path ?? w), {
|
|
122
|
-
...t.fetch === void 0 ? {} : { fetch: t.fetch },
|
|
123
|
-
method: "POST",
|
|
124
|
-
credentials: t.credentials ?? "omit",
|
|
125
|
-
headers: p(t.headers),
|
|
126
|
-
body: JSON.stringify(h(t)),
|
|
127
|
-
...t.signal === void 0 ? {} : { signal: t.signal }
|
|
128
|
-
});
|
|
129
|
-
if (!e?.connect_artifact)
|
|
130
|
-
throw new Error("Invalid controlplane response: missing `connect_artifact`");
|
|
131
|
-
return l(e.connect_artifact);
|
|
132
|
-
}
|
|
133
|
-
async function N(t) {
|
|
134
|
-
const e = String(t.entryTicket ?? "").trim();
|
|
135
|
-
if (e === "")
|
|
136
|
-
throw new Error("entryTicket is required");
|
|
137
|
-
const r = p(t.headers);
|
|
138
|
-
r.set("Authorization", `Bearer ${e}`);
|
|
139
|
-
const n = await f(u(t.baseUrl, t.path ?? y), {
|
|
140
|
-
...t.fetch === void 0 ? {} : { fetch: t.fetch },
|
|
141
|
-
method: "POST",
|
|
142
|
-
credentials: t.credentials ?? "omit",
|
|
143
|
-
headers: r,
|
|
144
|
-
body: JSON.stringify(h(t)),
|
|
145
|
-
...t.signal === void 0 ? {} : { signal: t.signal }
|
|
146
|
-
});
|
|
147
|
-
if (!n?.connect_artifact)
|
|
148
|
-
throw new Error("Invalid controlplane response: missing `connect_artifact`");
|
|
149
|
-
return l(n.connect_artifact);
|
|
150
|
-
}
|
|
151
|
-
export {
|
|
152
|
-
d as ControlplaneRequestError,
|
|
153
|
-
w as DEFAULT_CONNECT_ARTIFACT_PATH,
|
|
154
|
-
y as DEFAULT_ENTRY_CONNECT_ARTIFACT_PATH,
|
|
155
|
-
u as buildControlplaneURL,
|
|
156
|
-
_ as requestConnectArtifact,
|
|
157
|
-
f as requestControlplaneJSON,
|
|
158
|
-
N as requestEntryConnectArtifact
|
|
159
|
-
};
|