@floegence/floe-webapp-boot 0.49.0 → 0.50.1
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 +4 -0
- package/dist/acquisition.js +293 -239
- package/dist/artifact-source.d.ts +8 -1
- package/dist/artifact-source.js +70 -58
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -22
- package/package.json +2 -2
package/dist/acquisition.d.ts
CHANGED
|
@@ -108,5 +108,9 @@ export type MaterializeIsolatedOneShotOptions = Readonly<{
|
|
|
108
108
|
commitSpend: CommitSpend;
|
|
109
109
|
}>;
|
|
110
110
|
export declare function materializeIsolatedOneShot(options: MaterializeIsolatedOneShotOptions): Promise<IsolatedOneShotAcquisition>;
|
|
111
|
+
export type NativeIsolatedAcquisitionContext = Omit<IsolatedHandoffValidationContext, 'runtimeOrigin' | 'appOrigin'>;
|
|
112
|
+
export declare function materializeNativeIsolatedAcquisitionForSource(source: ArtifactSource, value: unknown, options: MaterializeOptions & Readonly<{
|
|
113
|
+
context: NativeIsolatedAcquisitionContext;
|
|
114
|
+
}>): Promise<ArtifactLease>;
|
|
111
115
|
export declare function connectIsolatedOneShot(acquisition: IsolatedOneShotAcquisition, options?: SessionOptions): Promise<ConnectedAcquisition>;
|
|
112
116
|
export {};
|
package/dist/acquisition.js
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import { createArtifactLease as
|
|
2
|
-
import { assertProxyRuntimeScope as
|
|
3
|
-
const
|
|
4
|
-
class
|
|
5
|
-
constructor(
|
|
6
|
-
super(`Floe acquisition failed (code=${
|
|
1
|
+
import { createArtifactLease as A, parseArtifact as T } from "@floegence/flowersec-core";
|
|
2
|
+
import { assertProxyRuntimeScope as U } from "@floegence/flowersec-core/proxy";
|
|
3
|
+
const O = 32, E = 16384, C = "#redeven=";
|
|
4
|
+
class o extends Error {
|
|
5
|
+
constructor(i) {
|
|
6
|
+
super(`Floe acquisition failed (code=${i})`), this.code = i, this.name = "AcquisitionError";
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
class
|
|
9
|
+
class w {
|
|
10
10
|
#e = void 0;
|
|
11
11
|
constructor() {
|
|
12
12
|
Object.freeze(this);
|
|
13
13
|
}
|
|
14
14
|
static create() {
|
|
15
|
-
return new
|
|
15
|
+
return new w();
|
|
16
16
|
}
|
|
17
|
-
static assertAuthentic(
|
|
18
|
-
|
|
17
|
+
static assertAuthentic(i) {
|
|
18
|
+
i.#e;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
class
|
|
21
|
+
class v {
|
|
22
22
|
#e = void 0;
|
|
23
23
|
constructor() {
|
|
24
24
|
Object.freeze(this);
|
|
25
25
|
}
|
|
26
26
|
static create() {
|
|
27
|
-
return new
|
|
27
|
+
return new v();
|
|
28
28
|
}
|
|
29
|
-
static assertAuthentic(
|
|
30
|
-
|
|
29
|
+
static assertAuthentic(i) {
|
|
30
|
+
i.#e;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
const g = /* @__PURE__ */ new WeakMap(),
|
|
34
|
-
function
|
|
35
|
-
if (g.has(e)) throw new
|
|
33
|
+
const g = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new Set();
|
|
34
|
+
function K(e) {
|
|
35
|
+
if (g.has(e)) throw new o("duplicate_acquisition_source");
|
|
36
36
|
g.set(e, { pending: [] });
|
|
37
37
|
}
|
|
38
|
-
async function
|
|
38
|
+
async function Q(e, i, t) {
|
|
39
39
|
const n = g.get(e);
|
|
40
|
-
if (n === void 0) throw new
|
|
41
|
-
const
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
(
|
|
47
|
-
n.pending.push(
|
|
40
|
+
if (n === void 0) throw new o("invalid_acquisition_source");
|
|
41
|
+
const c = await B(i, t, T);
|
|
42
|
+
return b(
|
|
43
|
+
c,
|
|
44
|
+
A,
|
|
45
|
+
t.commitSpend,
|
|
46
|
+
(r) => {
|
|
47
|
+
n.pending.push(r);
|
|
48
48
|
},
|
|
49
|
-
(
|
|
50
|
-
n.pending = n.pending.filter((a) => a !==
|
|
49
|
+
(r) => {
|
|
50
|
+
n.pending = n.pending.filter((a) => a !== r);
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
|
-
async function
|
|
54
|
+
async function ee(e, i, t) {
|
|
55
55
|
const n = g.get(e);
|
|
56
|
-
if (n === void 0) throw new
|
|
57
|
-
const
|
|
58
|
-
t,
|
|
56
|
+
if (n === void 0) throw new o("invalid_acquisition_source");
|
|
57
|
+
const c = await import("@floegence/flowersec-core/browser"), r = await B(
|
|
59
58
|
i,
|
|
60
|
-
|
|
59
|
+
t,
|
|
60
|
+
c.parsePrivateLoopbackArtifactV1
|
|
61
61
|
);
|
|
62
|
-
return
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
return b(
|
|
63
|
+
r,
|
|
64
|
+
c.createPrivateLoopbackArtifactLeaseV1,
|
|
65
|
+
t.commitSpend,
|
|
66
66
|
(a) => {
|
|
67
67
|
n.pending.push(a);
|
|
68
68
|
},
|
|
@@ -71,41 +71,41 @@ async function Q(e, t, i) {
|
|
|
71
71
|
}
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
if (
|
|
78
|
-
return (
|
|
79
|
-
if (
|
|
80
|
-
return
|
|
81
|
-
const n =
|
|
82
|
-
if (n.length !== 1 ||
|
|
83
|
-
throw
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
-
const
|
|
87
|
-
return
|
|
88
|
-
|
|
74
|
+
function te(e, i) {
|
|
75
|
+
const t = g.get(e);
|
|
76
|
+
if (t === void 0) return null;
|
|
77
|
+
if (i.state !== "connected" || i.currentSession === void 0)
|
|
78
|
+
return (i.state === "idle" || i.state === "waiting" || i.state === "failed" || i.state === "closed") && (t.pending = [], t.connected = void 0, t.connectedSession = void 0), null;
|
|
79
|
+
if (t.connected !== void 0 && t.connectedSession === i.currentSession)
|
|
80
|
+
return t.connected;
|
|
81
|
+
const n = t.pending.filter((a) => a.committed);
|
|
82
|
+
if (n.length !== 1 || t.pending.length !== 1)
|
|
83
|
+
throw t.pending = [], new o("connected_acquisition_mismatch");
|
|
84
|
+
const c = n[0];
|
|
85
|
+
if (c === void 0) throw new o("connected_acquisition_mismatch");
|
|
86
|
+
const r = w.create();
|
|
87
|
+
return q.set(
|
|
88
|
+
r,
|
|
89
89
|
Object.freeze({
|
|
90
|
-
session:
|
|
91
|
-
scope:
|
|
92
|
-
bindingIdentity:
|
|
93
|
-
attempt:
|
|
90
|
+
session: i.currentSession,
|
|
91
|
+
scope: c.scope,
|
|
92
|
+
bindingIdentity: c.bindingIdentity,
|
|
93
|
+
attempt: i.attempt
|
|
94
94
|
})
|
|
95
|
-
),
|
|
96
|
-
}
|
|
97
|
-
function te(e) {
|
|
98
|
-
const t = g.get(e);
|
|
99
|
-
t !== void 0 && (t.pending = [], t.connected = void 0, t.connectedSession = void 0);
|
|
95
|
+
), t.pending = [], t.connected = r, t.connectedSession = i.currentSession, r;
|
|
100
96
|
}
|
|
101
97
|
function ie(e) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (t === void 0) throw new r("invalid_connected_acquisition");
|
|
105
|
-
return t;
|
|
98
|
+
const i = g.get(e);
|
|
99
|
+
i !== void 0 && (i.pending = [], i.connected = void 0, i.connectedSession = void 0);
|
|
106
100
|
}
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
function ne(e) {
|
|
102
|
+
w.assertAuthentic(e);
|
|
103
|
+
const i = q.get(e);
|
|
104
|
+
if (i === void 0) throw new o("invalid_connected_acquisition");
|
|
105
|
+
return i;
|
|
106
|
+
}
|
|
107
|
+
async function oe(e) {
|
|
108
|
+
const i = e.rawHandoff, t = typeof i != "string" || P(`${C}${i}`) > E;
|
|
109
109
|
let n = !1;
|
|
110
110
|
try {
|
|
111
111
|
n = e.clearSensitiveLocation() === !0;
|
|
@@ -113,146 +113,199 @@ async function ne(e) {
|
|
|
113
113
|
n = !1;
|
|
114
114
|
}
|
|
115
115
|
if (!n)
|
|
116
|
-
throw e.navigateToLauncher(), new
|
|
117
|
-
if (
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
120
|
-
throw new
|
|
121
|
-
|
|
116
|
+
throw e.navigateToLauncher(), new o("isolated_location_clear_failed");
|
|
117
|
+
if (t) throw new o("isolated_handoff_too_large");
|
|
118
|
+
const c = m(i, "invalid_isolated_handoff"), r = await W(c);
|
|
119
|
+
if (I.has(r))
|
|
120
|
+
throw new o("isolated_handoff_consumed");
|
|
121
|
+
I.add(r);
|
|
122
122
|
let a;
|
|
123
123
|
try {
|
|
124
|
-
a = JSON.parse(new TextDecoder("utf-8", { fatal: !0 }).decode(
|
|
124
|
+
a = JSON.parse(new TextDecoder("utf-8", { fatal: !0 }).decode(c));
|
|
125
125
|
} catch {
|
|
126
|
-
throw new
|
|
126
|
+
throw new o("invalid_isolated_handoff");
|
|
127
127
|
}
|
|
128
|
-
const d =
|
|
129
|
-
|
|
128
|
+
const d = await F(
|
|
129
|
+
a,
|
|
130
|
+
e.validationContext,
|
|
131
|
+
e.commitSpend
|
|
132
|
+
);
|
|
133
|
+
let s;
|
|
134
|
+
const l = b(
|
|
135
|
+
d,
|
|
136
|
+
A,
|
|
137
|
+
e.commitSpend,
|
|
138
|
+
(u) => {
|
|
139
|
+
s = u;
|
|
140
|
+
},
|
|
141
|
+
() => {
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
if (s === void 0 || s.lease !== l)
|
|
145
|
+
throw new o("isolated_materialization_failed");
|
|
146
|
+
const p = v.create();
|
|
147
|
+
return L.set(p, { pending: s, state: "ready" }), p;
|
|
148
|
+
}
|
|
149
|
+
async function F(e, i, t) {
|
|
150
|
+
const n = H(e, i), c = await B(
|
|
151
|
+
n.acquisition,
|
|
130
152
|
{
|
|
131
|
-
commitSpend:
|
|
153
|
+
commitSpend: t,
|
|
132
154
|
expectedConsumer: "isolated",
|
|
133
|
-
validateSpendBinding: (
|
|
155
|
+
validateSpendBinding: (r) => {
|
|
156
|
+
J(n, r, i);
|
|
157
|
+
try {
|
|
158
|
+
i.validateTargetBinding(r.targetBinding);
|
|
159
|
+
} catch {
|
|
160
|
+
throw new o("invalid_spend_binding");
|
|
161
|
+
}
|
|
162
|
+
return `${r.artifactDigestB64u}.${r.projectionDigestB64u}`;
|
|
163
|
+
}
|
|
134
164
|
},
|
|
135
165
|
T
|
|
136
166
|
);
|
|
137
|
-
if (
|
|
138
|
-
throw new
|
|
139
|
-
if (
|
|
140
|
-
const
|
|
141
|
-
if (
|
|
142
|
-
throw new
|
|
167
|
+
if (c.scope.appBasePath !== n.app_path)
|
|
168
|
+
throw new o("isolated_app_path_mismatch");
|
|
169
|
+
if (c.scope.mode === "controller_bridge") {
|
|
170
|
+
const r = c.scope.controllerBridge.allowedOrigins;
|
|
171
|
+
if (r.length !== 1 || r[0] !== n.app_origin)
|
|
172
|
+
throw new o("isolated_allowed_origins_mismatch");
|
|
173
|
+
}
|
|
174
|
+
return c;
|
|
175
|
+
}
|
|
176
|
+
async function re(e, i, t) {
|
|
177
|
+
const n = g.get(e);
|
|
178
|
+
if (n === void 0) throw new o("invalid_acquisition_source");
|
|
179
|
+
const c = h(
|
|
180
|
+
i,
|
|
181
|
+
["v", "runtime_origin", "runtime_handoff_b64u"],
|
|
182
|
+
"invalid_isolated_handoff"
|
|
183
|
+
), r = c.runtime_handoff_b64u;
|
|
184
|
+
if (c.v !== 6 || typeof r != "string" || P(r) > E)
|
|
185
|
+
throw new o("invalid_isolated_handoff");
|
|
186
|
+
const a = m(r, "invalid_isolated_handoff");
|
|
187
|
+
let d;
|
|
188
|
+
try {
|
|
189
|
+
d = JSON.parse(new TextDecoder("utf-8", { fatal: !0 }).decode(a));
|
|
190
|
+
} catch {
|
|
191
|
+
throw new o("invalid_isolated_handoff");
|
|
143
192
|
}
|
|
144
|
-
|
|
145
|
-
|
|
193
|
+
const s = d, l = {
|
|
194
|
+
...t.context,
|
|
195
|
+
runtimeOrigin: f(c.runtime_origin),
|
|
196
|
+
appOrigin: f(s?.app_origin)
|
|
197
|
+
}, p = await F(
|
|
198
|
+
d,
|
|
199
|
+
l,
|
|
200
|
+
t.commitSpend
|
|
201
|
+
), u = s?.acquisition;
|
|
202
|
+
if (!u) throw new o("invalid_isolated_handoff");
|
|
203
|
+
return t.validateSpendBinding(R(u.spend_scope)), b(
|
|
146
204
|
p,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
() => {
|
|
205
|
+
A,
|
|
206
|
+
t.commitSpend,
|
|
207
|
+
(_) => n.pending.push(_),
|
|
208
|
+
(_) => {
|
|
209
|
+
n.pending = n.pending.filter((y) => y !== _);
|
|
153
210
|
}
|
|
154
211
|
);
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const i = E.get(e);
|
|
163
|
-
if (i === void 0 || i.state !== "ready")
|
|
164
|
-
throw new r("isolated_acquisition_consumed");
|
|
165
|
-
i.state = "connecting";
|
|
212
|
+
}
|
|
213
|
+
async function ce(e, i = {}) {
|
|
214
|
+
v.assertAuthentic(e);
|
|
215
|
+
const t = L.get(e);
|
|
216
|
+
if (t === void 0 || t.state !== "ready")
|
|
217
|
+
throw new o("isolated_acquisition_consumed");
|
|
218
|
+
t.state = "connecting";
|
|
166
219
|
try {
|
|
167
|
-
const { connect: n } = await import("@floegence/flowersec-core/browser"),
|
|
168
|
-
if (!
|
|
169
|
-
throw await
|
|
170
|
-
}), new
|
|
171
|
-
const
|
|
172
|
-
return
|
|
173
|
-
|
|
220
|
+
const { connect: n } = await import("@floegence/flowersec-core/browser"), c = await n(t.pending.lease, i);
|
|
221
|
+
if (!t.pending.committed)
|
|
222
|
+
throw await c.close().catch(() => {
|
|
223
|
+
}), new o("isolated_spend_not_committed");
|
|
224
|
+
const r = w.create();
|
|
225
|
+
return q.set(
|
|
226
|
+
r,
|
|
174
227
|
Object.freeze({
|
|
175
|
-
session:
|
|
176
|
-
scope:
|
|
177
|
-
bindingIdentity:
|
|
228
|
+
session: c,
|
|
229
|
+
scope: t.pending.scope,
|
|
230
|
+
bindingIdentity: t.pending.bindingIdentity,
|
|
178
231
|
attempt: 1
|
|
179
232
|
})
|
|
180
|
-
),
|
|
233
|
+
), t.state = "consumed", r;
|
|
181
234
|
} catch (n) {
|
|
182
|
-
throw
|
|
235
|
+
throw t.state = "consumed", n;
|
|
183
236
|
}
|
|
184
237
|
}
|
|
185
|
-
async function
|
|
186
|
-
const n =
|
|
238
|
+
async function B(e, i, t) {
|
|
239
|
+
const n = h(
|
|
187
240
|
e,
|
|
188
241
|
["v", "connect_artifact", "critical_scope_projection_json", "spend_scope"],
|
|
189
242
|
"invalid_acquisition_envelope"
|
|
190
243
|
);
|
|
191
244
|
if (n.v !== 1 || typeof n.connect_artifact != "string" || n.connect_artifact.length === 0 || typeof n.critical_scope_projection_json != "string" || n.critical_scope_projection_json.length === 0)
|
|
192
|
-
throw new
|
|
193
|
-
const
|
|
194
|
-
await D(
|
|
245
|
+
throw new o("invalid_acquisition_envelope");
|
|
246
|
+
const c = V(n.spend_scope, i.expectedConsumer), r = new TextEncoder().encode(n.connect_artifact), a = new TextEncoder().encode(n.critical_scope_projection_json);
|
|
247
|
+
await D(r, c.artifact_digest_b64u, "artifact_digest_mismatch"), await D(
|
|
195
248
|
a,
|
|
196
|
-
|
|
249
|
+
c.projection_digest_b64u,
|
|
197
250
|
"projection_digest_mismatch"
|
|
198
251
|
);
|
|
199
252
|
let d;
|
|
200
253
|
try {
|
|
201
254
|
d = JSON.parse(n.critical_scope_projection_json);
|
|
202
255
|
} catch {
|
|
203
|
-
throw new
|
|
256
|
+
throw new o("invalid_critical_scope_projection");
|
|
204
257
|
}
|
|
205
|
-
const
|
|
258
|
+
const s = h(
|
|
206
259
|
d,
|
|
207
260
|
["scope", "scope_version", "critical", "payload"],
|
|
208
261
|
"invalid_critical_scope_projection"
|
|
209
262
|
);
|
|
210
|
-
if (
|
|
211
|
-
throw new
|
|
212
|
-
let
|
|
263
|
+
if (s.scope !== "proxy.runtime" || s.scope_version !== 2 || s.critical !== !0)
|
|
264
|
+
throw new o("invalid_critical_scope_projection");
|
|
265
|
+
let l;
|
|
213
266
|
try {
|
|
214
|
-
|
|
267
|
+
l = U(s.payload);
|
|
215
268
|
} catch {
|
|
216
|
-
throw new
|
|
269
|
+
throw new o("invalid_proxy_runtime_scope");
|
|
217
270
|
}
|
|
218
|
-
let
|
|
271
|
+
let p;
|
|
219
272
|
try {
|
|
220
|
-
|
|
273
|
+
p = t(n.connect_artifact);
|
|
221
274
|
} catch {
|
|
222
|
-
throw new
|
|
275
|
+
throw new o("invalid_connect_artifact");
|
|
223
276
|
}
|
|
224
|
-
const
|
|
225
|
-
if (
|
|
226
|
-
throw new
|
|
277
|
+
const u = R(c), _ = i.validateSpendBinding(u);
|
|
278
|
+
if (_ !== void 0 && (typeof _ != "string" || _.trim() === "" || _ !== _.trim()))
|
|
279
|
+
throw new o("invalid_spend_binding_identity");
|
|
227
280
|
return Object.freeze({
|
|
228
|
-
artifact:
|
|
229
|
-
scope:
|
|
230
|
-
binding:
|
|
231
|
-
bindingIdentity:
|
|
232
|
-
receipt:
|
|
281
|
+
artifact: p,
|
|
282
|
+
scope: l,
|
|
283
|
+
binding: u,
|
|
284
|
+
bindingIdentity: _ ?? `${u.artifactDigestB64u}.${u.projectionDigestB64u}`,
|
|
285
|
+
receipt: c.receipt
|
|
233
286
|
});
|
|
234
287
|
}
|
|
235
|
-
function
|
|
236
|
-
const
|
|
237
|
-
let
|
|
238
|
-
const
|
|
239
|
-
const
|
|
240
|
-
if (
|
|
241
|
-
const
|
|
288
|
+
function b(e, i, t, n, c) {
|
|
289
|
+
const r = e.artifact, a = e.scope, d = e.binding, s = e.bindingIdentity;
|
|
290
|
+
let l = e.receipt, p;
|
|
291
|
+
const u = i(r, async (_) => {
|
|
292
|
+
const y = l;
|
|
293
|
+
if (l = void 0, y === void 0) throw new o("spend_binding_consumed");
|
|
294
|
+
const k = Object.freeze({
|
|
242
295
|
...d,
|
|
243
|
-
attemptId:
|
|
244
|
-
receipt:
|
|
296
|
+
attemptId: G(),
|
|
297
|
+
receipt: y
|
|
245
298
|
});
|
|
246
299
|
try {
|
|
247
|
-
await
|
|
248
|
-
} catch (
|
|
249
|
-
throw
|
|
300
|
+
await t(k, _), p.committed = !0;
|
|
301
|
+
} catch (N) {
|
|
302
|
+
throw c(p), N;
|
|
250
303
|
}
|
|
251
304
|
});
|
|
252
|
-
return
|
|
305
|
+
return p = { lease: u, scope: a, bindingIdentity: s, committed: !1 }, n(p), u;
|
|
253
306
|
}
|
|
254
|
-
function
|
|
255
|
-
const
|
|
307
|
+
function V(e, i) {
|
|
308
|
+
const t = h(
|
|
256
309
|
e,
|
|
257
310
|
[
|
|
258
311
|
"v",
|
|
@@ -268,24 +321,24 @@ function k(e, t) {
|
|
|
268
321
|
],
|
|
269
322
|
"invalid_spend_scope"
|
|
270
323
|
);
|
|
271
|
-
if (
|
|
272
|
-
throw new
|
|
273
|
-
const n = f(
|
|
274
|
-
if (Date.parse(
|
|
324
|
+
if (t.v !== 1 || typeof t.receipt != "string" || !M(t.receipt) || typeof t.artifact_digest_b64u != "string" || !x(t.artifact_digest_b64u) || typeof t.projection_digest_b64u != "string" || !x(t.projection_digest_b64u) || t.consumer !== i || typeof t.expires_at != "string" || !Z(t.expires_at) || !S(t.target_binding))
|
|
325
|
+
throw new o("invalid_spend_scope");
|
|
326
|
+
const n = f(t.launcher_origin), c = f(t.runtime_origin), r = f(t.app_origin);
|
|
327
|
+
if (Date.parse(t.expires_at) <= Date.now()) throw new o("expired_spend_scope");
|
|
275
328
|
return Object.freeze({
|
|
276
329
|
v: 1,
|
|
277
|
-
receipt:
|
|
278
|
-
artifact_digest_b64u:
|
|
279
|
-
projection_digest_b64u:
|
|
330
|
+
receipt: t.receipt,
|
|
331
|
+
artifact_digest_b64u: t.artifact_digest_b64u,
|
|
332
|
+
projection_digest_b64u: t.projection_digest_b64u,
|
|
280
333
|
launcher_origin: n,
|
|
281
|
-
runtime_origin:
|
|
282
|
-
app_origin:
|
|
283
|
-
consumer:
|
|
284
|
-
target_binding:
|
|
285
|
-
expires_at:
|
|
334
|
+
runtime_origin: c,
|
|
335
|
+
app_origin: r,
|
|
336
|
+
consumer: i,
|
|
337
|
+
target_binding: j(t.target_binding),
|
|
338
|
+
expires_at: t.expires_at
|
|
286
339
|
});
|
|
287
340
|
}
|
|
288
|
-
function
|
|
341
|
+
function R(e) {
|
|
289
342
|
return Object.freeze({
|
|
290
343
|
artifactDigestB64u: e.artifact_digest_b64u,
|
|
291
344
|
projectionDigestB64u: e.projection_digest_b64u,
|
|
@@ -297,8 +350,8 @@ function U(e) {
|
|
|
297
350
|
expiresAt: e.expires_at
|
|
298
351
|
});
|
|
299
352
|
}
|
|
300
|
-
function
|
|
301
|
-
const
|
|
353
|
+
function H(e, i) {
|
|
354
|
+
const t = h(
|
|
302
355
|
e,
|
|
303
356
|
[
|
|
304
357
|
"v",
|
|
@@ -315,125 +368,126 @@ function V(e, t) {
|
|
|
315
368
|
],
|
|
316
369
|
"invalid_isolated_handoff"
|
|
317
370
|
);
|
|
318
|
-
if (
|
|
319
|
-
throw new
|
|
320
|
-
return f(
|
|
371
|
+
if (t.v !== 6 || t.env_public_id !== i.envPublicId || t.floe_app !== i.floeApp || t.code_space_id !== i.codeSpaceId || t.app_path !== i.appPath || t.launcher_kind !== i.launcherKind || t.launcher_id !== i.launcherId || t.launcher_origin !== i.launcherOrigin || t.runtime_origin !== i.runtimeOrigin || t.app_origin !== i.appOrigin)
|
|
372
|
+
throw new o("isolated_context_mismatch");
|
|
373
|
+
return f(t.launcher_origin), f(t.runtime_origin), f(t.app_origin), t;
|
|
321
374
|
}
|
|
322
|
-
function
|
|
323
|
-
if (
|
|
324
|
-
throw new
|
|
375
|
+
function J(e, i, t) {
|
|
376
|
+
if (i.consumer !== "isolated" || i.launcherOrigin !== e.launcher_origin || i.runtimeOrigin !== e.runtime_origin || i.appOrigin !== e.app_origin || e.runtime_origin !== t.runtimeOrigin || e.app_origin !== t.appOrigin)
|
|
377
|
+
throw new o("isolated_spend_binding_mismatch");
|
|
325
378
|
}
|
|
326
|
-
function
|
|
379
|
+
function h(e, i, t) {
|
|
327
380
|
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
328
|
-
throw new
|
|
329
|
-
const n = e,
|
|
330
|
-
if (
|
|
331
|
-
throw new
|
|
381
|
+
throw new o(t);
|
|
382
|
+
const n = e, c = new Set(i), r = Object.keys(n);
|
|
383
|
+
if (r.length !== i.length || r.some((a) => !c.has(a)))
|
|
384
|
+
throw new o(t);
|
|
332
385
|
return n;
|
|
333
386
|
}
|
|
334
387
|
function f(e) {
|
|
335
|
-
if (typeof e != "string") throw new
|
|
336
|
-
let
|
|
388
|
+
if (typeof e != "string") throw new o("invalid_spend_scope");
|
|
389
|
+
let i;
|
|
337
390
|
try {
|
|
338
|
-
|
|
391
|
+
i = new URL(e);
|
|
339
392
|
} catch {
|
|
340
|
-
throw new
|
|
393
|
+
throw new o("invalid_spend_scope");
|
|
341
394
|
}
|
|
342
|
-
if (
|
|
343
|
-
throw new
|
|
395
|
+
if (i.protocol !== "https:" && i.protocol !== "http:" || i.origin !== e || i.username !== "" || i.password !== "")
|
|
396
|
+
throw new o("invalid_spend_scope");
|
|
344
397
|
return e;
|
|
345
398
|
}
|
|
346
|
-
function
|
|
347
|
-
const
|
|
348
|
-
if (
|
|
399
|
+
function M(e) {
|
|
400
|
+
const i = /^r1\.([A-Za-z0-9_-]{1,64})\.([A-Za-z0-9_-]+)$/u.exec(e);
|
|
401
|
+
if (i === null || i[2] === void 0) return !1;
|
|
349
402
|
try {
|
|
350
|
-
return
|
|
403
|
+
return m(i[2], "invalid_spend_scope").length === O;
|
|
351
404
|
} catch {
|
|
352
405
|
return !1;
|
|
353
406
|
}
|
|
354
407
|
}
|
|
355
408
|
function x(e) {
|
|
356
409
|
try {
|
|
357
|
-
return
|
|
410
|
+
return m(e, "invalid_spend_scope").length === O;
|
|
358
411
|
} catch {
|
|
359
412
|
return !1;
|
|
360
413
|
}
|
|
361
414
|
}
|
|
362
|
-
function
|
|
415
|
+
function Z(e) {
|
|
363
416
|
return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/u.test(e) ? Number.isFinite(Date.parse(e)) : !1;
|
|
364
417
|
}
|
|
365
|
-
function
|
|
366
|
-
return
|
|
367
|
-
(
|
|
418
|
+
function S(e, i = 0) {
|
|
419
|
+
return i > 32 ? !1 : e === null || typeof e == "string" || typeof e == "boolean" ? !0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.every((t) => S(t, i + 1)) : typeof e != "object" ? !1 : Object.values(e).every(
|
|
420
|
+
(t) => S(t, i + 1)
|
|
368
421
|
);
|
|
369
422
|
}
|
|
370
|
-
function
|
|
423
|
+
function j(e) {
|
|
371
424
|
if (Array.isArray(e)) {
|
|
372
|
-
for (const
|
|
425
|
+
for (const i of e) j(i);
|
|
373
426
|
return Object.freeze(e);
|
|
374
427
|
}
|
|
375
428
|
if (e !== null && typeof e == "object") {
|
|
376
|
-
for (const
|
|
429
|
+
for (const i of Object.values(e)) j(i);
|
|
377
430
|
return Object.freeze(e);
|
|
378
431
|
}
|
|
379
432
|
return e;
|
|
380
433
|
}
|
|
381
|
-
async function D(e,
|
|
382
|
-
const n = await
|
|
383
|
-
if (n.length !==
|
|
384
|
-
let
|
|
434
|
+
async function D(e, i, t) {
|
|
435
|
+
const n = await $(e), c = m(i, t);
|
|
436
|
+
if (n.length !== c.length) throw new o(t);
|
|
437
|
+
let r = 0;
|
|
385
438
|
for (let a = 0; a < n.length; a += 1)
|
|
386
|
-
|
|
387
|
-
if (
|
|
439
|
+
r |= n[a] ^ c[a];
|
|
440
|
+
if (r !== 0) throw new o(t);
|
|
388
441
|
}
|
|
389
|
-
async function
|
|
390
|
-
return
|
|
442
|
+
async function W(e) {
|
|
443
|
+
return z(await $(e));
|
|
391
444
|
}
|
|
392
|
-
async function
|
|
445
|
+
async function $(e) {
|
|
393
446
|
if (globalThis.crypto?.subtle === void 0)
|
|
394
|
-
throw new
|
|
395
|
-
const
|
|
447
|
+
throw new o("acquisition_crypto_unavailable");
|
|
448
|
+
const i = e.buffer.slice(
|
|
396
449
|
e.byteOffset,
|
|
397
450
|
e.byteOffset + e.byteLength
|
|
398
|
-
),
|
|
399
|
-
return new Uint8Array(
|
|
451
|
+
), t = await globalThis.crypto.subtle.digest("SHA-256", i);
|
|
452
|
+
return new Uint8Array(t);
|
|
400
453
|
}
|
|
401
|
-
function
|
|
454
|
+
function G() {
|
|
402
455
|
if (globalThis.crypto?.getRandomValues === void 0)
|
|
403
|
-
throw new
|
|
404
|
-
return
|
|
456
|
+
throw new o("acquisition_entropy_unavailable");
|
|
457
|
+
return z(globalThis.crypto.getRandomValues(new Uint8Array(O)));
|
|
405
458
|
}
|
|
406
|
-
function
|
|
407
|
-
if (!/^[A-Za-z0-9_-]*$/u.test(e) || e.length % 4 === 1) throw new
|
|
408
|
-
const
|
|
459
|
+
function m(e, i) {
|
|
460
|
+
if (!/^[A-Za-z0-9_-]*$/u.test(e) || e.length % 4 === 1) throw new o(i);
|
|
461
|
+
const t = e.replace(/-/gu, "+").replace(/_/gu, "/") + "=".repeat((4 - e.length % 4) % 4);
|
|
409
462
|
let n;
|
|
410
463
|
try {
|
|
411
|
-
n = atob(
|
|
464
|
+
n = atob(t);
|
|
412
465
|
} catch {
|
|
413
|
-
throw new
|
|
466
|
+
throw new o(i);
|
|
414
467
|
}
|
|
415
|
-
const
|
|
416
|
-
if (
|
|
417
|
-
return
|
|
468
|
+
const c = Uint8Array.from(n, (r) => r.charCodeAt(0));
|
|
469
|
+
if (z(c) !== e) throw new o(i);
|
|
470
|
+
return c;
|
|
418
471
|
}
|
|
419
|
-
function
|
|
420
|
-
let
|
|
421
|
-
for (const
|
|
422
|
-
return btoa(
|
|
472
|
+
function z(e) {
|
|
473
|
+
let i = "";
|
|
474
|
+
for (const t of e) i += String.fromCharCode(t);
|
|
475
|
+
return btoa(i).replace(/\+/gu, "-").replace(/\//gu, "_").replace(/=+$/u, "");
|
|
423
476
|
}
|
|
424
|
-
function
|
|
477
|
+
function P(e) {
|
|
425
478
|
return new TextEncoder().encode(e).length;
|
|
426
479
|
}
|
|
427
480
|
export {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
481
|
+
o as AcquisitionError,
|
|
482
|
+
w as ConnectedAcquisition,
|
|
483
|
+
v as IsolatedOneShotAcquisition,
|
|
484
|
+
ie as clearAcquisitionSource,
|
|
485
|
+
ce as connectIsolatedOneShot,
|
|
486
|
+
ne as connectedAcquisitionDetails,
|
|
487
|
+
Q as materializeAcquisitionForSource,
|
|
488
|
+
oe as materializeIsolatedOneShot,
|
|
489
|
+
re as materializeNativeIsolatedAcquisitionForSource,
|
|
490
|
+
ee as materializePrivateLoopbackAcquisitionForSource,
|
|
491
|
+
K as registerAcquisitionSource,
|
|
492
|
+
te as synchronizeAcquisitionSourceSnapshot
|
|
439
493
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ArtifactSource, JsonObject, RetryDisposition } from '@floegence/flowersec-core';
|
|
2
2
|
import type { PrivateLoopbackArtifactSourceV1 } from '@floegence/flowersec-core/browser';
|
|
3
|
-
import { type CommitSpend, type ValidateSpendBinding } from './acquisition';
|
|
3
|
+
import { type NativeIsolatedAcquisitionContext, type CommitSpend, type ValidateSpendBinding } from './acquisition';
|
|
4
4
|
export type ControlplaneArtifactSourceOptions = Readonly<{
|
|
5
5
|
baseUrl: string;
|
|
6
6
|
endpointId: string;
|
|
@@ -34,4 +34,11 @@ export type ClassifiedControlplaneFailure = Readonly<{
|
|
|
34
34
|
}>;
|
|
35
35
|
export declare function classifyControlplaneFailure(input: ControlplaneFailureInput): ClassifiedControlplaneFailure;
|
|
36
36
|
export declare function createControlplaneArtifactSource(options: ControlplaneArtifactSourceOptions): ArtifactSource;
|
|
37
|
+
/** Acquires an isolated application lease for a native controller without a browser handoff.
|
|
38
|
+
* The caller validates the exact launcher, runtime, app, and resource binding and
|
|
39
|
+
* supplies the existing spend callback. No consumer or origin is rewritten.
|
|
40
|
+
*/
|
|
41
|
+
export declare function createIsolatedControlplaneArtifactSource(options: ControlplaneArtifactSourceOptions & Readonly<{
|
|
42
|
+
isolatedContext: NativeIsolatedAcquisitionContext;
|
|
43
|
+
}>): ArtifactSource;
|
|
37
44
|
export declare function createPrivateLoopbackControlplaneArtifactSource(options: PrivateLoopbackControlplaneArtifactSourceOptions): PrivateLoopbackArtifactSourceV1;
|
package/dist/artifact-source.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { registerAcquisitionSource as
|
|
2
|
-
const
|
|
3
|
-
class
|
|
1
|
+
import { registerAcquisitionSource as u, materializeNativeIsolatedAcquisitionForSource as S, AcquisitionError as m, materializeAcquisitionForSource as k, materializePrivateLoopbackAcquisitionForSource as _ } from "./acquisition.js";
|
|
2
|
+
const h = /^[a-z][a-z0-9_]{0,63}$/u;
|
|
3
|
+
class s extends Error {
|
|
4
4
|
constructor(r, t) {
|
|
5
5
|
super(`Floe controlplane request failed (code=${t})`), this.status = r, this.code = t, this.name = "ControlplaneRequestError";
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function v(e) {
|
|
9
9
|
const r = e.toLowerCase();
|
|
10
10
|
return r === "localhost" || r === "::1" || r === "127.0.0.1" || r.startsWith("127.");
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function z(e, r) {
|
|
13
13
|
let t;
|
|
14
14
|
try {
|
|
15
15
|
t = new URL(e);
|
|
16
16
|
} catch {
|
|
17
|
-
throw new
|
|
17
|
+
throw new s(0, "transport_policy_denied");
|
|
18
18
|
}
|
|
19
|
-
if (t.protocol !== "https:" && !(r && t.protocol === "http:" &&
|
|
20
|
-
throw new
|
|
19
|
+
if (t.protocol !== "https:" && !(r && t.protocol === "http:" && v(t.hostname)))
|
|
20
|
+
throw new s(0, "transport_policy_denied");
|
|
21
21
|
return t.pathname = t.pathname.replace(/\/+$/u, ""), t;
|
|
22
22
|
}
|
|
23
23
|
function j(e, r) {
|
|
24
24
|
const t = r === void 0 ? "/v1/connect/artifact" : "/v1/connect/artifact/entry", o = e.pathname === "/" ? "" : e.pathname;
|
|
25
25
|
return new URL(`${o}${t}`, e).toString();
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
if (!
|
|
27
|
+
function O(e) {
|
|
28
|
+
if (!h.test(e.code))
|
|
29
29
|
return Object.freeze({
|
|
30
30
|
code: "invalid_error_code",
|
|
31
31
|
disposition: Object.freeze({ kind: "terminal" })
|
|
@@ -33,7 +33,7 @@ function v(e) {
|
|
|
33
33
|
if (new Set(e.retryableBusinessCodes ?? []).has(e.code))
|
|
34
34
|
return Object.freeze({ code: e.code, disposition: Object.freeze({ kind: "retryable" }) });
|
|
35
35
|
if (e.status === 429) {
|
|
36
|
-
const t =
|
|
36
|
+
const t = T(e.retryAfter, e.nowUnixMilliseconds ?? Date.now());
|
|
37
37
|
return Object.freeze({
|
|
38
38
|
code: e.code,
|
|
39
39
|
disposition: Object.freeze(t === void 0 ? { kind: "retryable" } : { kind: "retry_after", notBeforeUnixMilliseconds: t })
|
|
@@ -41,31 +41,42 @@ function v(e) {
|
|
|
41
41
|
}
|
|
42
42
|
return e.status === 408 || e.status === 425 || e.status >= 500 ? Object.freeze({ code: e.code, disposition: Object.freeze({ kind: "retryable" }) }) : Object.freeze({ code: e.code, disposition: Object.freeze({ kind: "terminal" }) });
|
|
43
43
|
}
|
|
44
|
-
function B(e) {
|
|
45
|
-
const r = m(e, w);
|
|
46
|
-
return b(r), r;
|
|
47
|
-
}
|
|
48
44
|
function L(e) {
|
|
49
|
-
const r =
|
|
45
|
+
const r = p(e, k);
|
|
46
|
+
return u(r), r;
|
|
47
|
+
}
|
|
48
|
+
function I(e) {
|
|
49
|
+
const r = p(
|
|
50
|
+
e,
|
|
51
|
+
(t, o, i) => S(t, o, {
|
|
52
|
+
...i,
|
|
53
|
+
context: e.isolatedContext
|
|
54
|
+
}),
|
|
55
|
+
"isolated"
|
|
56
|
+
);
|
|
57
|
+
return u(r), r;
|
|
58
|
+
}
|
|
59
|
+
function N(e) {
|
|
60
|
+
const r = A(e.baseUrl), t = p(
|
|
50
61
|
{ ...e, baseUrl: r.origin, allowLoopbackHTTP: !0 },
|
|
51
|
-
|
|
62
|
+
_
|
|
52
63
|
);
|
|
53
|
-
return
|
|
64
|
+
return u(t), t;
|
|
54
65
|
}
|
|
55
|
-
function
|
|
66
|
+
function p(e, r, t = "trusted") {
|
|
56
67
|
if (typeof e.commitSpend != "function") throw new TypeError("commitSpend is required");
|
|
57
68
|
if (typeof e.validateSpendBinding != "function")
|
|
58
69
|
throw new TypeError("validateSpendBinding is required");
|
|
59
|
-
const
|
|
60
|
-
if (typeof
|
|
61
|
-
const
|
|
70
|
+
const o = e.fetch ?? globalThis.fetch;
|
|
71
|
+
if (typeof o != "function") throw new TypeError("fetch is required");
|
|
72
|
+
const i = z(e.baseUrl, e.allowLoopbackHTTP === !0), c = j(i, e.entryTicket), b = {
|
|
62
73
|
acquire: async ({ signal: d }) => {
|
|
63
74
|
try {
|
|
64
75
|
const n = {
|
|
65
76
|
endpoint_id: e.endpointId,
|
|
66
77
|
...e.payload === void 0 ? {} : { payload: e.payload },
|
|
67
78
|
...e.entryTicket === void 0 && e.correlation !== void 0 ? { correlation: { trace_id: e.correlation.traceId } } : {}
|
|
68
|
-
},
|
|
79
|
+
}, a = await o(c, {
|
|
69
80
|
method: "POST",
|
|
70
81
|
headers: {
|
|
71
82
|
accept: "application/json",
|
|
@@ -77,37 +88,37 @@ function m(e, r) {
|
|
|
77
88
|
redirect: "error",
|
|
78
89
|
signal: d
|
|
79
90
|
});
|
|
80
|
-
if (!
|
|
81
|
-
const
|
|
82
|
-
return { kind: "failure", ...
|
|
83
|
-
status:
|
|
84
|
-
code:
|
|
85
|
-
retryAfter:
|
|
91
|
+
if (!a.ok) {
|
|
92
|
+
const l = await g(a);
|
|
93
|
+
return { kind: "failure", ...O({
|
|
94
|
+
status: a.status,
|
|
95
|
+
code: l,
|
|
96
|
+
retryAfter: a.headers.get("retry-after"),
|
|
86
97
|
retryableBusinessCodes: e.retryableBusinessCodes
|
|
87
98
|
}) };
|
|
88
99
|
}
|
|
89
|
-
let
|
|
100
|
+
let y;
|
|
90
101
|
try {
|
|
91
|
-
|
|
102
|
+
y = await a.json();
|
|
92
103
|
} catch {
|
|
93
|
-
return
|
|
104
|
+
return f("invalid_controlplane_response");
|
|
94
105
|
}
|
|
95
|
-
const
|
|
106
|
+
const w = await r(b, y, {
|
|
96
107
|
commitSpend: e.commitSpend,
|
|
97
|
-
validateSpendBinding: (
|
|
108
|
+
validateSpendBinding: (l) => {
|
|
98
109
|
try {
|
|
99
|
-
return e.validateSpendBinding(
|
|
110
|
+
return e.validateSpendBinding(l);
|
|
100
111
|
} catch {
|
|
101
|
-
throw new
|
|
112
|
+
throw new m("invalid_spend_binding");
|
|
102
113
|
}
|
|
103
114
|
},
|
|
104
|
-
expectedConsumer:
|
|
115
|
+
expectedConsumer: t
|
|
105
116
|
});
|
|
106
|
-
return Object.freeze({ kind: "lease", lease:
|
|
117
|
+
return Object.freeze({ kind: "lease", lease: w });
|
|
107
118
|
} catch (n) {
|
|
108
119
|
if (d.aborted) throw d.reason ?? new DOMException("Aborted", "AbortError");
|
|
109
120
|
if (n instanceof DOMException && n.name === "AbortError") throw n;
|
|
110
|
-
return n instanceof
|
|
121
|
+
return n instanceof m || n instanceof s ? f(n.code) : Object.freeze({
|
|
111
122
|
kind: "failure",
|
|
112
123
|
code: "network_error",
|
|
113
124
|
disposition: Object.freeze({ kind: "retryable" })
|
|
@@ -115,28 +126,28 @@ function m(e, r) {
|
|
|
115
126
|
}
|
|
116
127
|
}
|
|
117
128
|
};
|
|
118
|
-
return
|
|
129
|
+
return b;
|
|
119
130
|
}
|
|
120
|
-
function
|
|
131
|
+
function A(e) {
|
|
121
132
|
let r;
|
|
122
133
|
try {
|
|
123
134
|
r = new URL(e);
|
|
124
135
|
} catch {
|
|
125
|
-
throw new
|
|
136
|
+
throw new s(0, "transport_policy_denied");
|
|
126
137
|
}
|
|
127
|
-
if (e !== r.origin || r.protocol !== "http:" || r.username !== "" || r.password !== "" || !
|
|
128
|
-
throw new
|
|
138
|
+
if (e !== r.origin || r.protocol !== "http:" || r.username !== "" || r.password !== "" || !C(r.port) || !E(r.hostname))
|
|
139
|
+
throw new s(0, "transport_policy_denied");
|
|
129
140
|
return r;
|
|
130
141
|
}
|
|
131
|
-
function
|
|
142
|
+
function C(e) {
|
|
132
143
|
if (!/^[1-9][0-9]*$/u.test(e)) return !1;
|
|
133
144
|
const r = Number(e);
|
|
134
145
|
return Number.isSafeInteger(r) && r >= 1024 && r <= 65535;
|
|
135
146
|
}
|
|
136
|
-
function
|
|
147
|
+
function E(e) {
|
|
137
148
|
return e === "127.0.0.1" || e === "[::1]";
|
|
138
149
|
}
|
|
139
|
-
async function
|
|
150
|
+
async function g(e) {
|
|
140
151
|
try {
|
|
141
152
|
const r = await e.json();
|
|
142
153
|
if (r !== null && typeof r == "object" && !Array.isArray(r)) {
|
|
@@ -150,28 +161,29 @@ async function E(e) {
|
|
|
150
161
|
}
|
|
151
162
|
return "request_failed";
|
|
152
163
|
}
|
|
153
|
-
function
|
|
164
|
+
function T(e, r) {
|
|
154
165
|
if (e == null) return;
|
|
155
166
|
const t = e.trim();
|
|
156
167
|
if (/^\d+$/u.test(t)) {
|
|
157
|
-
const
|
|
158
|
-
if (!Number.isSafeInteger(
|
|
159
|
-
const
|
|
160
|
-
return Number.isSafeInteger(
|
|
168
|
+
const i = Number(t);
|
|
169
|
+
if (!Number.isSafeInteger(i)) return;
|
|
170
|
+
const c = r + i * 1e3;
|
|
171
|
+
return Number.isSafeInteger(c) && c > r ? c : void 0;
|
|
161
172
|
}
|
|
162
173
|
const o = Date.parse(t);
|
|
163
174
|
return Number.isSafeInteger(o) && o > r ? o : void 0;
|
|
164
175
|
}
|
|
165
|
-
function
|
|
176
|
+
function f(e) {
|
|
166
177
|
return Object.freeze({
|
|
167
178
|
kind: "failure",
|
|
168
|
-
code:
|
|
179
|
+
code: h.test(e) ? e : "invalid_error_code",
|
|
169
180
|
disposition: Object.freeze({ kind: "terminal" })
|
|
170
181
|
});
|
|
171
182
|
}
|
|
172
183
|
export {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
184
|
+
s as ControlplaneRequestError,
|
|
185
|
+
O as classifyControlplaneFailure,
|
|
186
|
+
L as createControlplaneArtifactSource,
|
|
187
|
+
I as createIsolatedControlplaneArtifactSource,
|
|
188
|
+
N as createPrivateLoopbackControlplaneArtifactSource
|
|
177
189
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type { WaitForMessageOptions } from './messaging';
|
|
|
3
3
|
export { postMessageToOrigins, waitForMessage } from './messaging';
|
|
4
4
|
export { getSessionStorage, removeSessionStorage, setSessionStorage } from './storage';
|
|
5
5
|
export type { ArtifactSource, ArtifactSourceResult } from '@floegence/flowersec-core';
|
|
6
|
-
export { createControlplaneArtifactSource, createPrivateLoopbackControlplaneArtifactSource, ControlplaneRequestError, } from './artifact-source';
|
|
6
|
+
export { createControlplaneArtifactSource, createIsolatedControlplaneArtifactSource, createPrivateLoopbackControlplaneArtifactSource, ControlplaneRequestError, } from './artifact-source';
|
|
7
7
|
export { classifyControlplaneFailure } from './artifact-source';
|
|
8
8
|
export type { ClassifiedControlplaneFailure, ControlplaneArtifactSourceOptions, ControlplaneFailureInput, PrivateLoopbackControlplaneArtifactSourceOptions, } from './artifact-source';
|
|
9
9
|
export { AcquisitionError, clearAcquisitionSource, connectIsolatedOneShot, ConnectedAcquisition, IsolatedOneShotAcquisition, materializePrivateLoopbackAcquisitionForSource, materializeIsolatedOneShot, synchronizeAcquisitionSourceSnapshot, } from './acquisition';
|
package/dist/index.js
CHANGED
|
@@ -1,41 +1,42 @@
|
|
|
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 S, classifyControlplaneFailure as u, createControlplaneArtifactSource as m, createPrivateLoopbackControlplaneArtifactSource as x } from "./artifact-source.js";
|
|
5
|
-
import { AcquisitionError as g, ConnectedAcquisition as
|
|
3
|
+
import { getSessionStorage as s, removeSessionStorage as l, setSessionStorage as p } from "./storage.js";
|
|
4
|
+
import { ControlplaneRequestError as S, classifyControlplaneFailure as u, createControlplaneArtifactSource as m, createIsolatedControlplaneArtifactSource as C, createPrivateLoopbackControlplaneArtifactSource as x } from "./artifact-source.js";
|
|
5
|
+
import { AcquisitionError as g, ConnectedAcquisition as h, IsolatedOneShotAcquisition as y, clearAcquisitionSource as P, connectIsolatedOneShot as q, materializeIsolatedOneShot as v, materializePrivateLoopbackAcquisitionForSource as O, synchronizeAcquisitionSourceSnapshot as d } from "./acquisition.js";
|
|
6
6
|
import { createAcquisitionConnectionLifecycle as L } from "./acquisition-lifecycle.js";
|
|
7
|
-
import { createArtifactDirectConnectionConfig as
|
|
8
|
-
import { ServerSentEventStreamError as F, fetchServerSentEvents as
|
|
9
|
-
import { ProxyBootstrapOwner as
|
|
7
|
+
import { createArtifactDirectConnectionConfig as B, createArtifactTunnelConnectionConfig as I, createPrivateLoopbackDirectConnectionConfig as b, createProxyRuntimeTunnelConnectionConfig as k } from "./connection.js";
|
|
8
|
+
import { ServerSentEventStreamError as F, fetchServerSentEvents as T } from "./server-sent-events.js";
|
|
9
|
+
import { ProxyBootstrapOwner as H, closeProxyBootstrap as M, createProxyBootstrapOwner as R, synchronizeProxyBootstrap as j } from "./proxy-bootstrap.js";
|
|
10
10
|
export {
|
|
11
11
|
g as AcquisitionError,
|
|
12
|
-
|
|
12
|
+
h as ConnectedAcquisition,
|
|
13
13
|
S as ControlplaneRequestError,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
y as IsolatedOneShotAcquisition,
|
|
15
|
+
H as ProxyBootstrapOwner,
|
|
16
16
|
F as ServerSentEventStreamError,
|
|
17
17
|
u as classifyControlplaneFailure,
|
|
18
|
-
|
|
18
|
+
P as clearAcquisitionSource,
|
|
19
19
|
r as clearLocationHash,
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
M as closeProxyBootstrap,
|
|
21
|
+
q as connectIsolatedOneShot,
|
|
22
22
|
L as createAcquisitionConnectionLifecycle,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
B as createArtifactDirectConnectionConfig,
|
|
24
|
+
I as createArtifactTunnelConnectionConfig,
|
|
25
25
|
m as createControlplaneArtifactSource,
|
|
26
|
+
C as createIsolatedControlplaneArtifactSource,
|
|
26
27
|
x as createPrivateLoopbackControlplaneArtifactSource,
|
|
27
28
|
b as createPrivateLoopbackDirectConnectionConfig,
|
|
28
|
-
|
|
29
|
+
R as createProxyBootstrapOwner,
|
|
29
30
|
k as createProxyRuntimeTunnelConnectionConfig,
|
|
30
|
-
|
|
31
|
+
T as fetchServerSentEvents,
|
|
31
32
|
s as getSessionStorage,
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
v as materializeIsolatedOneShot,
|
|
34
|
+
O as materializePrivateLoopbackAcquisitionForSource,
|
|
34
35
|
t as parseHashParam,
|
|
35
36
|
i as postMessageToOrigins,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
l as removeSessionStorage,
|
|
38
|
+
p as setSessionStorage,
|
|
39
|
+
d as synchronizeAcquisitionSourceSnapshot,
|
|
40
|
+
j as synchronizeProxyBootstrap,
|
|
40
41
|
a as waitForMessage
|
|
41
42
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@floegence/floe-webapp-boot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.1",
|
|
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": "5.0
|
|
38
|
+
"@floegence/flowersec-core": "5.1.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"typescript": "^5.9.3",
|