@floegence/floe-webapp-boot 0.47.0 → 0.48.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/acquisition.d.ts +1 -2
- package/dist/artifact-source.js +18 -18
- package/dist/index.d.ts +0 -2
- package/dist/index.js +26 -31
- package/package.json +2 -2
- package/dist/scope.d.ts +0 -21
- package/dist/scope.js +0 -29
package/dist/acquisition.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ArtifactLease, type ArtifactSource, type ConnectionSnapshot, type JsonValue, type Session } from '@floegence/flowersec-core';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PrivateLoopbackArtifactLeaseV1, PrivateLoopbackArtifactSourceV1, SessionOptions } from '@floegence/flowersec-core/browser';
|
|
3
3
|
import { type ProxyRuntimeScope } from '@floegence/flowersec-core/proxy';
|
|
4
4
|
export type CriticalScopeProjectionV1 = Readonly<{
|
|
5
5
|
scope: 'proxy.runtime';
|
|
@@ -109,5 +109,4 @@ export type MaterializeIsolatedOneShotOptions = Readonly<{
|
|
|
109
109
|
}>;
|
|
110
110
|
export declare function materializeIsolatedOneShot(options: MaterializeIsolatedOneShotOptions): Promise<IsolatedOneShotAcquisition>;
|
|
111
111
|
export declare function connectIsolatedOneShot(acquisition: IsolatedOneShotAcquisition, options?: SessionOptions): Promise<ConnectedAcquisition>;
|
|
112
|
-
export type BrowserControllerOptions = ConnectionControllerOptions;
|
|
113
112
|
export {};
|
package/dist/artifact-source.js
CHANGED
|
@@ -21,8 +21,8 @@ function _(e, r) {
|
|
|
21
21
|
return t.pathname = t.pathname.replace(/\/+$/u, ""), t;
|
|
22
22
|
}
|
|
23
23
|
function j(e, r) {
|
|
24
|
-
const t = r === void 0 ? "/v1/connect/artifact" : "/v1/connect/artifact/entry";
|
|
25
|
-
return new URL(`${
|
|
24
|
+
const t = r === void 0 ? "/v1/connect/artifact" : "/v1/connect/artifact/entry", o = e.pathname === "/" ? "" : e.pathname;
|
|
25
|
+
return new URL(`${o}${t}`, e).toString();
|
|
26
26
|
}
|
|
27
27
|
function v(e) {
|
|
28
28
|
if (!y.test(e.code))
|
|
@@ -58,10 +58,10 @@ function m(e, r) {
|
|
|
58
58
|
throw new TypeError("validateSpendBinding is required");
|
|
59
59
|
const t = e.fetch ?? globalThis.fetch;
|
|
60
60
|
if (typeof t != "function") throw new TypeError("fetch is required");
|
|
61
|
-
const
|
|
61
|
+
const o = _(e.baseUrl, e.allowLoopbackHTTP === !0), s = j(o, e.entryTicket), i = {
|
|
62
62
|
acquire: async ({ signal: d }) => {
|
|
63
63
|
try {
|
|
64
|
-
const
|
|
64
|
+
const n = {
|
|
65
65
|
endpoint_id: e.endpointId,
|
|
66
66
|
...e.payload === void 0 ? {} : { payload: e.payload },
|
|
67
67
|
...e.entryTicket === void 0 && e.correlation !== void 0 ? { correlation: { trace_id: e.correlation.traceId } } : {}
|
|
@@ -72,16 +72,16 @@ function m(e, r) {
|
|
|
72
72
|
"content-type": "application/json",
|
|
73
73
|
...e.entryTicket === void 0 ? {} : { authorization: `Bearer ${e.entryTicket}` }
|
|
74
74
|
},
|
|
75
|
-
body: JSON.stringify(
|
|
75
|
+
body: JSON.stringify(n),
|
|
76
76
|
credentials: "omit",
|
|
77
77
|
redirect: "error",
|
|
78
78
|
signal: d
|
|
79
79
|
});
|
|
80
80
|
if (!c.ok) {
|
|
81
|
-
const
|
|
81
|
+
const f = await E(c);
|
|
82
82
|
return { kind: "failure", ...v({
|
|
83
83
|
status: c.status,
|
|
84
|
-
code:
|
|
84
|
+
code: f,
|
|
85
85
|
retryAfter: c.headers.get("retry-after"),
|
|
86
86
|
retryableBusinessCodes: e.retryableBusinessCodes
|
|
87
87
|
}) };
|
|
@@ -90,13 +90,13 @@ function m(e, r) {
|
|
|
90
90
|
try {
|
|
91
91
|
u = await c.json();
|
|
92
92
|
} catch {
|
|
93
|
-
return
|
|
93
|
+
return l("invalid_controlplane_response");
|
|
94
94
|
}
|
|
95
95
|
const h = await r(i, u, {
|
|
96
96
|
commitSpend: e.commitSpend,
|
|
97
|
-
validateSpendBinding: (
|
|
97
|
+
validateSpendBinding: (f) => {
|
|
98
98
|
try {
|
|
99
|
-
return e.validateSpendBinding(
|
|
99
|
+
return e.validateSpendBinding(f);
|
|
100
100
|
} catch {
|
|
101
101
|
throw new p("invalid_spend_binding");
|
|
102
102
|
}
|
|
@@ -104,10 +104,10 @@ function m(e, r) {
|
|
|
104
104
|
expectedConsumer: "trusted"
|
|
105
105
|
});
|
|
106
106
|
return Object.freeze({ kind: "lease", lease: h });
|
|
107
|
-
} catch (
|
|
107
|
+
} catch (n) {
|
|
108
108
|
if (d.aborted) throw d.reason ?? new DOMException("Aborted", "AbortError");
|
|
109
|
-
if (
|
|
110
|
-
return
|
|
109
|
+
if (n instanceof DOMException && n.name === "AbortError") throw n;
|
|
110
|
+
return n instanceof p || n instanceof a ? l(n.code) : Object.freeze({
|
|
111
111
|
kind: "failure",
|
|
112
112
|
code: "network_error",
|
|
113
113
|
disposition: Object.freeze({ kind: "retryable" })
|
|
@@ -142,8 +142,8 @@ async function E(e) {
|
|
|
142
142
|
if (r !== null && typeof r == "object" && !Array.isArray(r)) {
|
|
143
143
|
const t = r.error;
|
|
144
144
|
if (t !== null && typeof t == "object" && !Array.isArray(t)) {
|
|
145
|
-
const
|
|
146
|
-
if (typeof
|
|
145
|
+
const o = t.code;
|
|
146
|
+
if (typeof o == "string") return o;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
} catch {
|
|
@@ -159,10 +159,10 @@ function g(e, r) {
|
|
|
159
159
|
const i = r + s * 1e3;
|
|
160
160
|
return Number.isSafeInteger(i) && i > r ? i : void 0;
|
|
161
161
|
}
|
|
162
|
-
const
|
|
163
|
-
return Number.isSafeInteger(
|
|
162
|
+
const o = Date.parse(t);
|
|
163
|
+
return Number.isSafeInteger(o) && o > r ? o : void 0;
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function l(e) {
|
|
166
166
|
return Object.freeze({
|
|
167
167
|
kind: "failure",
|
|
168
168
|
code: y.test(e) ? e : "invalid_error_code",
|
package/dist/index.d.ts
CHANGED
|
@@ -16,5 +16,3 @@ export type { FetchServerSentEventsOptions, ServerSentEvent, ServerSentEventStre
|
|
|
16
16
|
export { fetchServerSentEvents, ServerSentEventStreamError } from './server-sent-events';
|
|
17
17
|
export { closeProxyBootstrap, createProxyBootstrapOwner, ProxyBootstrapOwner, synchronizeProxyBootstrap, } from './proxy-bootstrap';
|
|
18
18
|
export type { ControllerBridgeProxyBootstrapContext, ProxyBootstrapBinding, ProxyBootstrapOwnerOptions, ProxyBootstrapSnapshot, ServiceWorkerProxyBootstrapContext, } from './proxy-bootstrap';
|
|
19
|
-
export type { ScopeEnvelope, ScopeResolver, ScopeResolverMap, ValidatedCriticalScopeProjection, } from './scope';
|
|
20
|
-
export { createBootstrapScopeResolvers, FLOWERSEC_BOOTSTRAP_SCOPE_RESOLVERS, PROXY_RUNTIME_SCOPE_NAME, validateProxyRuntimeScopeEntry, } from './scope';
|
package/dist/index.js
CHANGED
|
@@ -1,46 +1,41 @@
|
|
|
1
1
|
import { clearLocationHash as r, parseHashParam as t } from "./hash.js";
|
|
2
2
|
import { postMessageToOrigins as i, waitForMessage as a } from "./messaging.js";
|
|
3
|
-
import { getSessionStorage as s, removeSessionStorage as
|
|
4
|
-
import { ControlplaneRequestError as
|
|
5
|
-
import { AcquisitionError as
|
|
6
|
-
import { createAcquisitionConnectionLifecycle as
|
|
7
|
-
import { createArtifactDirectConnectionConfig as
|
|
3
|
+
import { getSessionStorage as s, removeSessionStorage as p, setSessionStorage as l } from "./storage.js";
|
|
4
|
+
import { ControlplaneRequestError as S, classifyControlplaneFailure as u, createControlplaneArtifactSource as m, createPrivateLoopbackControlplaneArtifactSource as x } from "./artifact-source.js";
|
|
5
|
+
import { AcquisitionError as g, ConnectedAcquisition as A, IsolatedOneShotAcquisition as h, clearAcquisitionSource as y, connectIsolatedOneShot as P, materializeIsolatedOneShot as q, materializePrivateLoopbackAcquisitionForSource as v, synchronizeAcquisitionSourceSnapshot as O } from "./acquisition.js";
|
|
6
|
+
import { createAcquisitionConnectionLifecycle as L } from "./acquisition-lifecycle.js";
|
|
7
|
+
import { createArtifactDirectConnectionConfig as z, createArtifactTunnelConnectionConfig as B, createPrivateLoopbackDirectConnectionConfig as b, createProxyRuntimeTunnelConnectionConfig as k } from "./connection.js";
|
|
8
8
|
import { ServerSentEventStreamError as F, fetchServerSentEvents as I } from "./server-sent-events.js";
|
|
9
|
-
import { ProxyBootstrapOwner as
|
|
10
|
-
import { FLOWERSEC_BOOTSTRAP_SCOPE_RESOLVERS as N, PROXY_RUNTIME_SCOPE_NAME as U, createBootstrapScopeResolvers as V, validateProxyRuntimeScopeEntry as W } from "./scope.js";
|
|
9
|
+
import { ProxyBootstrapOwner as D, closeProxyBootstrap as H, createProxyBootstrapOwner as M, synchronizeProxyBootstrap as R } from "./proxy-bootstrap.js";
|
|
11
10
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
U as PROXY_RUNTIME_SCOPE_NAME,
|
|
18
|
-
b as ProxyBootstrapOwner,
|
|
11
|
+
g as AcquisitionError,
|
|
12
|
+
A as ConnectedAcquisition,
|
|
13
|
+
S as ControlplaneRequestError,
|
|
14
|
+
h as IsolatedOneShotAcquisition,
|
|
15
|
+
D as ProxyBootstrapOwner,
|
|
19
16
|
F as ServerSentEventStreamError,
|
|
20
17
|
u as classifyControlplaneFailure,
|
|
21
|
-
|
|
18
|
+
y as clearAcquisitionSource,
|
|
22
19
|
r as clearLocationHash,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
V as createBootstrapScopeResolvers,
|
|
20
|
+
H as closeProxyBootstrap,
|
|
21
|
+
P as connectIsolatedOneShot,
|
|
22
|
+
L as createAcquisitionConnectionLifecycle,
|
|
23
|
+
z as createArtifactDirectConnectionConfig,
|
|
24
|
+
B as createArtifactTunnelConnectionConfig,
|
|
29
25
|
m as createControlplaneArtifactSource,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
x as createPrivateLoopbackControlplaneArtifactSource,
|
|
27
|
+
b as createPrivateLoopbackDirectConnectionConfig,
|
|
28
|
+
M as createProxyBootstrapOwner,
|
|
29
|
+
k as createProxyRuntimeTunnelConnectionConfig,
|
|
34
30
|
I as fetchServerSentEvents,
|
|
35
31
|
s as getSessionStorage,
|
|
36
|
-
|
|
32
|
+
q as materializeIsolatedOneShot,
|
|
37
33
|
v as materializePrivateLoopbackAcquisitionForSource,
|
|
38
34
|
t as parseHashParam,
|
|
39
35
|
i as postMessageToOrigins,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
W as validateProxyRuntimeScopeEntry,
|
|
36
|
+
p as removeSessionStorage,
|
|
37
|
+
l as setSessionStorage,
|
|
38
|
+
O as synchronizeAcquisitionSourceSnapshot,
|
|
39
|
+
R as synchronizeProxyBootstrap,
|
|
45
40
|
a as waitForMessage
|
|
46
41
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@floegence/floe-webapp-boot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@floegence/flowersec-core": "
|
|
38
|
+
"@floegence/flowersec-core": "5.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"typescript": "^5.9.3",
|
package/dist/scope.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type ProxyRuntimeScope } from '@floegence/flowersec-core/proxy';
|
|
2
|
-
export declare const PROXY_RUNTIME_SCOPE_NAME = "proxy.runtime";
|
|
3
|
-
export type ScopeEnvelope = Readonly<{
|
|
4
|
-
scope: string;
|
|
5
|
-
scope_version: number;
|
|
6
|
-
critical: boolean;
|
|
7
|
-
payload: unknown;
|
|
8
|
-
}>;
|
|
9
|
-
export type ValidatedCriticalScopeProjection = Readonly<{
|
|
10
|
-
scope: 'proxy.runtime';
|
|
11
|
-
scope_version: 2;
|
|
12
|
-
critical: true;
|
|
13
|
-
payload: ProxyRuntimeScope;
|
|
14
|
-
}>;
|
|
15
|
-
export type ScopeResolver = (entry: ScopeEnvelope) => ValidatedCriticalScopeProjection;
|
|
16
|
-
export type ScopeResolverMap = Readonly<Record<string, ScopeResolver>>;
|
|
17
|
-
export declare function validateProxyRuntimeScopeEntry(entry: ScopeEnvelope): ValidatedCriticalScopeProjection;
|
|
18
|
-
export declare const FLOWERSEC_BOOTSTRAP_SCOPE_RESOLVERS: Readonly<{
|
|
19
|
-
"proxy.runtime": typeof validateProxyRuntimeScopeEntry;
|
|
20
|
-
}>;
|
|
21
|
-
export declare function createBootstrapScopeResolvers(extra?: ScopeResolverMap): ScopeResolverMap;
|
package/dist/scope.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { PROXY_RUNTIME_SCOPE as o, assertProxyRuntimeScope as t } from "@floegence/flowersec-core/proxy";
|
|
2
|
-
const r = "proxy.runtime";
|
|
3
|
-
function c(e) {
|
|
4
|
-
if (e === null || typeof e != "object" || Array.isArray(e) || Object.keys(e).length !== 4 || !Object.keys(e).every((i) => ["scope", "scope_version", "critical", "payload"].includes(i)))
|
|
5
|
-
throw new TypeError(`invalid ${r} projection envelope`);
|
|
6
|
-
if (e.scope !== o.name || e.scope_version !== o.version || e.critical !== !0)
|
|
7
|
-
throw new TypeError(`unsupported ${r} critical scope projection`);
|
|
8
|
-
return Object.freeze({
|
|
9
|
-
scope: o.name,
|
|
10
|
-
scope_version: o.version,
|
|
11
|
-
critical: !0,
|
|
12
|
-
payload: t(e.payload)
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
const p = Object.freeze({
|
|
16
|
-
[r]: c
|
|
17
|
-
});
|
|
18
|
-
function n(e) {
|
|
19
|
-
return e ? Object.freeze({
|
|
20
|
-
...e,
|
|
21
|
-
[r]: c
|
|
22
|
-
}) : p;
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
p as FLOWERSEC_BOOTSTRAP_SCOPE_RESOLVERS,
|
|
26
|
-
r as PROXY_RUNTIME_SCOPE_NAME,
|
|
27
|
-
n as createBootstrapScopeResolvers,
|
|
28
|
-
c as validateProxyRuntimeScopeEntry
|
|
29
|
-
};
|