@floegence/floe-webapp-boot 0.41.0 → 0.41.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.
@@ -94,25 +94,25 @@ async function te(e) {
94
94
  } catch {
95
95
  throw new n("invalid_isolated_handoff");
96
96
  }
97
- const _ = P(a, e.validationContext), p = await x(_.acquisition, {
97
+ const _ = P(a, e.validationContext), u = await x(_.acquisition, {
98
98
  commitSpend: e.commitSpend,
99
99
  expectedConsumer: "isolated",
100
100
  validateSpendBinding: (d) => (k(_, d, e.validationContext), e.validationContext.validateTargetBinding(d.targetBinding), `${d.artifactDigestB64u}.${d.projectionDigestB64u}`)
101
101
  });
102
- if (p.scope.appBasePath !== _.app_path) throw new n("isolated_app_path_mismatch");
103
- if (p.scope.mode === "controller_bridge") {
104
- const d = p.scope.controllerBridge.allowedOrigins;
102
+ if (u.scope.appBasePath !== _.app_path) throw new n("isolated_app_path_mismatch");
103
+ if (u.scope.mode === "controller_bridge") {
104
+ const d = u.scope.controllerBridge.allowedOrigins;
105
105
  if (d.length !== 1 || d[0] !== _.app_origin)
106
106
  throw new n("isolated_allowed_origins_mismatch");
107
107
  }
108
108
  let s;
109
- const l = D(p, e.commitSpend, (d) => {
109
+ const l = D(u, e.commitSpend, (d) => {
110
110
  s = d;
111
111
  }, () => {
112
112
  });
113
113
  if (s === void 0 || s.lease !== l) throw new n("isolated_materialization_failed");
114
- const u = m.create();
115
- return z.set(u, { pending: s, state: "ready" }), u;
114
+ const p = m.create();
115
+ return z.set(p, { pending: s, state: "ready" }), p;
116
116
  }
117
117
  async function ie(e, i = {}) {
118
118
  m.assertAuthentic(e);
@@ -150,9 +150,9 @@ async function x(e, i) {
150
150
  const _ = w(a, ["scope", "scope_version", "critical", "payload"], "invalid_critical_scope_projection");
151
151
  if (_.scope !== "proxy.runtime" || _.scope_version !== 2 || _.critical !== !0)
152
152
  throw new n("invalid_critical_scope_projection");
153
- let p;
153
+ let u;
154
154
  try {
155
- p = C(_.payload);
155
+ u = C(_.payload);
156
156
  } catch {
157
157
  throw new n("invalid_proxy_runtime_scope");
158
158
  }
@@ -162,30 +162,30 @@ async function x(e, i) {
162
162
  } catch {
163
163
  throw new n("invalid_connect_artifact");
164
164
  }
165
- const l = N(r), u = i.validateSpendBinding(l);
166
- if (u !== void 0 && (u.trim() === "" || u !== u.trim()))
165
+ const l = N(r), p = i.validateSpendBinding(l);
166
+ if (p !== void 0 && (typeof p != "string" || p.trim() === "" || p !== p.trim()))
167
167
  throw new n("invalid_spend_binding_identity");
168
168
  return Object.freeze({
169
169
  artifact: s,
170
- scope: p,
170
+ scope: u,
171
171
  binding: l,
172
- bindingIdentity: u ?? `${l.artifactDigestB64u}.${l.projectionDigestB64u}`,
172
+ bindingIdentity: p ?? `${l.artifactDigestB64u}.${l.projectionDigestB64u}`,
173
173
  receipt: r.receipt
174
174
  });
175
175
  }
176
176
  function D(e, i, t, r) {
177
177
  const c = e.artifact, o = e.scope, a = e.binding, _ = e.bindingIdentity;
178
- let p = e.receipt, s;
179
- const l = $(c, async (u) => {
180
- const d = p;
181
- if (p = void 0, d === void 0) throw new n("spend_binding_consumed");
178
+ let u = e.receipt, s;
179
+ const l = $(c, async (p) => {
180
+ const d = u;
181
+ if (u = void 0, d === void 0) throw new n("spend_binding_consumed");
182
182
  const T = Object.freeze({
183
183
  ...a,
184
184
  attemptId: J(),
185
185
  receipt: d
186
186
  });
187
187
  try {
188
- await i(T, u), s.committed = !0;
188
+ await i(T, p), s.committed = !0;
189
189
  } catch (E) {
190
190
  throw r(s), E;
191
191
  }
@@ -1,11 +1,11 @@
1
- import { registerAcquisitionSource as p, materializeAcquisitionForSource as b, AcquisitionError as m } from "./acquisition.js";
2
- const l = /^[a-z][a-z0-9_]{0,63}$/u;
3
- class d extends Error {
1
+ import { registerAcquisitionSource as b, materializeAcquisitionForSource as h, AcquisitionError as u } from "./acquisition.js";
2
+ const y = /^[a-z][a-z0-9_]{0,63}$/u;
3
+ class f extends Error {
4
4
  constructor(t, r) {
5
5
  super(`Floe controlplane request failed (code=${r})`), this.status = t, this.code = r, this.name = "ControlplaneRequestError";
6
6
  }
7
7
  }
8
- function h(e) {
8
+ function m(e) {
9
9
  const t = e.toLowerCase();
10
10
  return t === "localhost" || t === "::1" || t === "127.0.0.1" || t.startsWith("127.");
11
11
  }
@@ -14,23 +14,23 @@ function w(e, t) {
14
14
  try {
15
15
  r = new URL(e);
16
16
  } catch {
17
- throw new d(0, "transport_policy_denied");
17
+ throw new f(0, "transport_policy_denied");
18
18
  }
19
- if (r.protocol !== "https:" && !(t && r.protocol === "http:" && h(r.hostname)))
20
- throw new d(0, "transport_policy_denied");
19
+ if (r.protocol !== "https:" && !(t && r.protocol === "http:" && m(r.hostname)))
20
+ throw new f(0, "transport_policy_denied");
21
21
  return r.pathname = r.pathname.replace(/\/+$/u, ""), r;
22
22
  }
23
23
  function j(e, t) {
24
24
  const r = t === void 0 ? "/v1/connect/artifact" : "/v1/connect/artifact/entry";
25
25
  return new URL(`${e.pathname}${r}`, e).toString();
26
26
  }
27
- function z(e) {
28
- if (!l.test(e.code))
27
+ function v(e) {
28
+ if (!y.test(e.code))
29
29
  return Object.freeze({ code: "invalid_error_code", disposition: Object.freeze({ kind: "terminal" }) });
30
30
  if (new Set(e.retryableBusinessCodes ?? []).has(e.code))
31
31
  return Object.freeze({ code: e.code, disposition: Object.freeze({ kind: "retryable" }) });
32
32
  if (e.status === 429) {
33
- const r = S(e.retryAfter, e.nowUnixMilliseconds ?? Date.now());
33
+ const r = O(e.retryAfter, e.nowUnixMilliseconds ?? Date.now());
34
34
  return Object.freeze({
35
35
  code: e.code,
36
36
  disposition: Object.freeze(r === void 0 ? { kind: "retryable" } : { kind: "retry_after", notBeforeUnixMilliseconds: r })
@@ -63,30 +63,36 @@ function _(e) {
63
63
  signal: i
64
64
  });
65
65
  if (!a.ok) {
66
- const y = await O(a);
67
- return { kind: "failure", ...z({
66
+ const s = await z(a);
67
+ return { kind: "failure", ...v({
68
68
  status: a.status,
69
- code: y,
69
+ code: s,
70
70
  retryAfter: a.headers.get("retry-after"),
71
71
  retryableBusinessCodes: e.retryableBusinessCodes
72
72
  }) };
73
73
  }
74
- let f;
74
+ let l;
75
75
  try {
76
- f = await a.json();
76
+ l = await a.json();
77
77
  } catch {
78
- return s("invalid_controlplane_response");
78
+ return d("invalid_controlplane_response");
79
79
  }
80
- const u = await b(c, f, {
80
+ const p = await h(c, l, {
81
81
  commitSpend: e.commitSpend,
82
- validateSpendBinding: e.validateSpendBinding,
82
+ validateSpendBinding: (s) => {
83
+ try {
84
+ return e.validateSpendBinding(s);
85
+ } catch {
86
+ throw new u("invalid_spend_binding");
87
+ }
88
+ },
83
89
  expectedConsumer: "trusted"
84
90
  });
85
- return Object.freeze({ kind: "lease", lease: u });
91
+ return Object.freeze({ kind: "lease", lease: p });
86
92
  } catch (o) {
87
93
  if (i.aborted) throw i.reason ?? new DOMException("Aborted", "AbortError");
88
94
  if (o instanceof DOMException && o.name === "AbortError") throw o;
89
- return o instanceof m || o instanceof d ? s(o.code) : Object.freeze({
95
+ return o instanceof u || o instanceof f ? d(o.code) : Object.freeze({
90
96
  kind: "failure",
91
97
  code: "network_error",
92
98
  disposition: Object.freeze({ kind: "retryable" })
@@ -94,9 +100,9 @@ function _(e) {
94
100
  }
95
101
  }
96
102
  };
97
- return p(c), c;
103
+ return b(c), c;
98
104
  }
99
- async function O(e) {
105
+ async function z(e) {
100
106
  try {
101
107
  const t = await e.json();
102
108
  if (t !== null && typeof t == "object" && !Array.isArray(t)) {
@@ -110,7 +116,7 @@ async function O(e) {
110
116
  }
111
117
  return "request_failed";
112
118
  }
113
- function S(e, t) {
119
+ function O(e, t) {
114
120
  if (e == null) return;
115
121
  const r = e.trim();
116
122
  if (/^\d+$/u.test(r)) {
@@ -122,15 +128,15 @@ function S(e, t) {
122
128
  const n = Date.parse(r);
123
129
  return Number.isSafeInteger(n) && n > t ? n : void 0;
124
130
  }
125
- function s(e) {
131
+ function d(e) {
126
132
  return Object.freeze({
127
133
  kind: "failure",
128
- code: l.test(e) ? e : "invalid_error_code",
134
+ code: y.test(e) ? e : "invalid_error_code",
129
135
  disposition: Object.freeze({ kind: "terminal" })
130
136
  });
131
137
  }
132
138
  export {
133
- d as ControlplaneRequestError,
134
- z as classifyControlplaneFailure,
139
+ f as ControlplaneRequestError,
140
+ v as classifyControlplaneFailure,
135
141
  _ as createControlplaneArtifactSource
136
142
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-boot",
3
- "version": "0.41.0",
3
+ "version": "0.41.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "clean": "rm -rf dist *.tsbuildinfo"
35
35
  },
36
36
  "dependencies": {
37
- "@floegence/flowersec-core": "2.5.0"
37
+ "@floegence/flowersec-core": "2.5.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "typescript": "^5.9.3",