@franzzemen/brokenstock-shell 0.3.2 → 0.4.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.
@@ -84,9 +84,6 @@ class AuthenticationService {
84
84
  ...(ngDevMode ? [{ debugName: "authenticating" }] : /* istanbul ignore next */ []));
85
85
  this.userSession = signal(undefined, /* @ts-ignore */
86
86
  ...(ngDevMode ? [{ debugName: "userSession" }] : /* istanbul ignore next */ []));
87
- /** Plan-feature grants for the current session. Absent key = not granted. */
88
- this.features = signal({}, /* @ts-ignore */
89
- ...(ngDevMode ? [{ debugName: "features" }] : /* istanbul ignore next */ []));
90
87
  this.conflictSessions = signal(undefined, /* @ts-ignore */
91
88
  ...(ngDevMode ? [{ debugName: "conflictSessions" }] : /* istanbul ignore next */ []));
92
89
  this.pendingCredentials = signal(undefined, /* @ts-ignore */
@@ -108,36 +105,19 @@ class AuthenticationService {
108
105
  return this.#auth;
109
106
  }
110
107
  // Legacy hasRole/hasAnyRole removed (legacy-authz-teardown): sessions carry no
111
- // roles, and every gate migrated to hasFeature (commerce) with the BE enforcing
112
- // the security axis.
113
- /**
114
- * Is this BOOLEAN feature granted and on? e.g. `hasFeature('real-time')`.
115
- *
116
- * Strictly `=== true`, matching the back end's `hasFeature`. It used to be
117
- * `!!this.features()[slug]`, which is NOT a valid entitlement test now that `0` is
118
- * a real state: `Features` has FOUR states and truthiness collapses two of them.
119
- *
120
- * - key absent → not granted (an upsell)
121
- * - `0` → granted, ZERO allowance (a limit — a different product, and
122
- * FALSY, so `!!` reported it as "not in your plan")
123
- * - `true` → granted, unlimited
124
- * - `number`>0 → granted with that limit
125
- *
126
- * It also matters in the other direction: `!!` passed on any positive number, so a
127
- * boolean slug misconfigured with a numeric value would show the affordance while
128
- * the BE — which requires exactly `true` — refused every call behind it. The user
129
- * sees the door and cannot open it.
130
- *
131
- * For QUANTITY features use {@link featureValue} and compare the limit yourself;
132
- * this returns false for every numeric grant, including a valid one.
133
- */
134
- hasFeature(slug) {
135
- return this.authenticated() && this.features()[slug] === true;
136
- }
137
- /** Raw plan-feature value (`true` for boolean grants, the numeric limit for quantity features, else undefined). */
138
- featureValue(slug) {
139
- return this.features()[slug];
140
- }
108
+ // roles, and every gate moved to hasFeature (commerce) with the BE enforcing the
109
+ // security axis.
110
+ //
111
+ // `hasFeature` and `featureValue` are now gone too, with all entitlement gating
112
+ // (commercial-surface-decommission.prd.md D3). BrokenStock is not a commercial
113
+ // product; there is nothing to be entitled to. Per P1 every capability they hid is
114
+ // unconditionally available, so the callers did not migrate to some other check —
115
+ // they simply stopped asking. The session's `features` map is no longer read here at
116
+ // all, which is what makes it safe for the back end to stop populating it (E9).
117
+ //
118
+ // The security axis is unaffected and still enforced server-side: this app cannot see
119
+ // security roles by design (`@franzzemen/endpoint-identity` is deliberately absent
120
+ // from its dependency graph).
141
121
  refresh() {
142
122
  if (this.#refreshing) {
143
123
  return this.#refreshing;
@@ -195,7 +175,6 @@ class AuthenticationService {
195
175
  // @ts-ignore
196
176
  delete authResponse.session.token;
197
177
  this.userSession.set(authResponse.session);
198
- this.features.set(authResponse.features ?? {});
199
178
  const auth = response.headers.get(HttpHeader.Authorization);
200
179
  if (!auth || !BEARER_TOKEN_REGEX.test(auth)) {
201
180
  reject('Unable to login');
@@ -253,7 +232,6 @@ class AuthenticationService {
253
232
  const body = await response.json();
254
233
  this.#auth = auth;
255
234
  this.userSession.set(body.session);
256
- this.features.set(body.features ?? {});
257
235
  return true;
258
236
  }
259
237
  catch {
@@ -263,7 +241,6 @@ class AuthenticationService {
263
241
  #clearSession() {
264
242
  this.authenticated.set(false);
265
243
  this.userSession.set(undefined);
266
- this.features.set({});
267
244
  this.conflictSessions.set(undefined);
268
245
  this.pendingCredentials.set(undefined);
269
246
  this.#auth = 'Bearer ..';